Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

I have a watch function in my AngularJS application.

$scope.$watch('quartzCrystal', function () { 

... 

}

However, after some condition (in my example, changing the page at my single-page application) I want to stop that watch (as like clearing timeout).

How can I do that?

1 Answer

0 votes
by (106k points)

The $watch in AngularJS returns a deregistration function. Calling it would deregister the $watcher.

var listener = $scope.$watch("quartz", function () {});

 // ... 

listener(); 

Related questions

0 votes
1 answer
asked Aug 28, 2019 in Web Technology by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...