Reputation: 6400
I want to know why a method is called two times while it is used in angularjs binding expression.
you can find my code here at jsbin
why the callMe() method is called two times. I found the same question already posted but could not get a satisfactory answer. And if we want to avoid this to be called two times how to do it.
Upvotes: 1
Views: 64
Reputation: 5857
You are binding a function to an expression
<p>{{callMe()}}</p>
that's why it's called many times, because it runs everytime when angularjs calls digest()... Here is a picture how digest work maybe it helps better...
Upvotes: 1