Within my $scope, I have an object with multiple attributes, like so:
$scope.content = {
name : 'myname',
description : 'mydescription',
keyword : 'some keyword'
}
I am attempting to monitor any changes in each attribute. I tried setting a watch on the object itself, but it did not capture changes made to its individual attributes (which are modified through UI bindings).
$scope.$watch('content', function(){
// do something
}
However, if I specifically set a watch on a particular attribute, such as the name, then I can track changes for that attribute.
$scope.$watch('content.name', function(){
// do something
}
Is there a way to listen for changes in all attributes of an object without setting watches on each one individually?