Shivprasad Koirala
Shivprasad Koirala

Reputation: 28696

Number of watchers in Angular

I am bit confused on the number of watchers in a angular code.I have a extremely simple Angular Controller with just one variable.

function SomeClass($scope,$sce) {
        $scope.Data = "";
    }

This variable is binded to a textbox and also displayed as expression.

<input type="text" name="name" value="" ng-model="Data" />
{{Data}}

When i profile in Batarang tool i see 3 watchers for {{Data}} , So first question should not it be just one watcher. One expression one watcher to evaluate. I do understand one watcher triggers other watchers but 3 looks a weird number.

And is the second watcher for the textbox ng-model binding and why 2 watchers. Or is there something wrong with batarang

enter image description here

Upvotes: 3

Views: 580

Answers (0)

Related Questions