Firing $watch event manually in angularjs
We have few options:
- Use $scope.$apply() to run the digest loop which call all of the watch expressions.
- Put you inner watch code inside a function and call it manually.
- Change
messages.
Explanation for second one:
var watchFunc = function(){
// the code
}
$scope.$watch('message',watchFunc);
watchFunc();
No comments:
Post a Comment