I have this data
in my controller
$scope.data = {
home: {
baseValue: \"1\",
name: \"home\"
},
co
In this kind of scenario there is no way to circumvent utilizing multiple watches, another way to do this is by utilizing $watchCollection
to watch the array of object values, you can get this array using the Object.values
function.
scope.$watchCollection(function() {
return Object.values(obj);
}, function(newValues, oldValues) {
// now you are watching all the values for changes!
// if you want to fire a callback with the object as an argument:
if (angular.isFunction(scope.callback())) {
scope.callback()(obj);
}
});