Angularjs: why there are 3 watchers for 1 binding? Angularjs: why there are 3 watchers for 1 binding? angularjs angularjs

Angularjs: why there are 3 watchers for 1 binding?


I think Angular Batarang has a wrong counter of watchers. I checked with few different sources, and all except AngularJS Batarang show me single watcher on your code. Check out this question with function:

(function () {     var root = angular.element(document.getElementsByTagName('body'));    var watchers = [];    var f = function (element) {        angular.forEach(['$scope', '$isolateScope'], function (scopeProperty) {             if (element.data() && element.data().hasOwnProperty(scopeProperty)) {                angular.forEach(element.data()[scopeProperty].$$watchers, function (watcher) {                    watchers.push(watcher);                });            }        });        angular.forEach(element.children(), function (childElement) {            f(angular.element(childElement));        });    };    f(root);    // Remove duplicate watchers    var watchersWithoutDuplicates = [];    angular.forEach(watchers, function(item) {        if(watchersWithoutDuplicates.indexOf(item) < 0) {             watchersWithoutDuplicates.push(item);        }    });    console.log(watchersWithoutDuplicates.length);})();

And you can check Watchers extension for chrome. Both show 1 watcher.