Last Updated: February 25, 2016
·
5.535K
· yassershaikh

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.
});

Interview Questions And Answers