You just can't do it. $watchjust add a callback to check if the object that should be executed during digests has changed.
I assume that one of the main differences from frameworks, such as Backbonewhere you extend the object Model.
In this case, you may need to intentionally (t23) intentionally (update the model and launch observers), but this is a stretch ...
Update
The problem is that you think there is a correlation between the watch and the model changes, but just not. Adding a clock just adds something to check when starting the digest cycle.
This cycle is not caused by changes in something on $scope, but rather calls $scope.$applyor directly calls $scope.$digest.
, (?) Angular $scope.$apply . , , $timeout ngClick , , $scope.$apply .
II
, - ?
$scope.foo = {
get bar () { return getting(); },
set bar (value) { setting(value); }
};
var bar;
function setting (value) {
var stack = getStack();
console.log(value, stack);
bar = value;
}
function getting () {
console.log(getStack());
}
function getStack () {
try {
throw new Error('foo');
} catch (e) {
return e.stack || e;
}
}
