How to use $watch in AngularJs
$watch is an important feature present in AngularJs. It can be used to keep a watch on any value and trgiiger a function when that value changes.
In the below snippet, a watch is kept on the 'DollarRate' object present in the scope of the controller where this watch is defined.
$scope.$watch('DollarRate', function(newValue, oldValue) {
// do something with the new or the old value.
});
Written by Yasser Shaikh
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Angularjs
Authors
Related Tags
#angularjs
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#