How to disable Watcher in AngularJS?

$watch returns a de-registration function. Calling it would de-register the $watcher.

var myVariableWatchObj = $scope.$watch("myWatchAttribute", function () {
          // code to perform
});
//.. Calling function as below would clear the watch
myVariableWatchObj();

Leave a Reply