All:
I am new to AngularJS, current what I want to do is to figure out which line cause the $watch
handling function get called.
For a small example:
I set $scope.name = ""
and call a function changeName()
:
function changeName(){
$scope.name = "new Name";
...
$http.get("someurl")
.then(function(data){ $scope.name = data.newname; })
}
$scope.$watch("name", function(newName, oldName){
handlingfunctionHere();
});
There is multiple changes to $scope.name
which make $scope.$watch
trigger, but when I debug in the chrome, I can not tell which action lead to that triggering from call stack, could anyone show me how to debug this?
Thanks