In this scenario, we have a
angular-resource variable / object
within the scope that serves as form data:
$scope.form = {
name: 'bob',
email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f99b969bb99b969b8ad79a9694">[email protected]</a>'
}
I have implemented a watch function to monitor changes in the name
variable.
$scope.$watch('form.name', function(newVal) {
if(newVal) {
alert(newVal)
}
});
How can I set up a watch to detect any changes in fields such as name, email, or any other potential values within scope.form?
The ultimate goal is to toggle the 'save' button on the form based on whether the user has made any modifications.