Counting the number of watchers on a page in angular.js

less than 1 minute read

A large number of angular.js watchers are usually the source of slowdowns in angular build applications. When using `` or $scope.$watch(...) angular will create a new watcher to check for changes on each $digest cycle and be able to notify the controller or update the view. It is generally accepted that once the number of watchers reaches 2000+, an application will start to suffer.

With the following, you can count the number of watchers on a page.

Just paste it in the console or put it in some debug block on the page.

Leave a Comment