javascript - Angular: obtain cause of a $watch to be triggered -


a short question: in angular, there way whatsoever obtain "root cause" of $watch triggered?

let's have following javascript code:

$scope.$watch("foo", function(value){     // here i'd know if change triggered      // due change in ngmodel or through ngclick };  $scope.changefoo = function(){     $scope.foo = "bar" }; 

and html:

<input ng-model="foo"> <button ng-click="changefoo()">change foo > bar</button> 

in $watch i'd know caused fired. in case, change in ngmodel or value changed in function of ngclick?

no, there no way current implementation.

$watch triggered running function called $apply. function doesn't know triggered it.

you going need perspective fix problem.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -