user3554664
user3554664

Reputation: 349

Why is a scope's $$watchers length not equal to the scope's $$watchersCount

What is the difference between a scope's $$watchers field and $$watchersCount? Why are they not always the same?

On the angularjs.org homepage, running angular.element('body').scope() in Chrome's developer tools, it's possible to see:

$$watchers: Array[3]
$$watchersCount: 80

What is the connection between these two fields?

Upvotes: 3

Views: 796

Answers (1)

Pankaj Parkar
Pankaj Parkar

Reputation: 136194

$$watchers: Represent number of $$watchers array's length on current scope.

Where as

$$watchersCount: Number watchers present on current scope node & its descendants scope $$watchers array.length

Upvotes: 4

Related Questions