I'm doing some simple scope watching like:
$scope.$watch('myObject', function(newValue, oldValue) {
if (newValue !== oldValue) {
return newValue;
}
}, true);
Where myObject is a normal object that has several properties. I would like to only return the property that changed, I.e, if there's a property which gets changed, like myObject.changedProperty, I would like to just return that.
Yet I want to watch the entire object (so, I don't have to set up different watches for each property). How can this be done?
Thank you!