The AngularJs remembers the values and it always
compare to the previous values. If find any changes in the value it automatically
fire the change event. That is also called dirty checking.
The Angular create the $watch internally.
The watch means that angular watches the changes in the variable on the $scope object.
The watches are created using the $scope.$watch() method and the $scope.watch() method creates a watch of some variables.
The HTML tells the AngularJs compiler to create
the $watch for controller methods and its run inside the $apply method.
The Angular create the $watch internally.
The watch means that angular watches the changes in the variable on the $scope object.
The watches are created using the $scope.$watch() method and the $scope.watch() method creates a watch of some variables.
When you register a watch you need to pass two functions. i.e.
·
One is value function.
·
And other is listener function.
Try the new Angular 2 and Run the live example http://goo.gl/NcDUuF