Hi Jochen,

On digest every expression in the view is evaluated. If it is an scope var, 
there is some intel that only renders the view if there is indeed an 
update. If there is an function, it is called, and then the view is 
updated, and another digest-cycle gets scheduled (your function might have 
side-effects that needs the view updated again!).
If you have a handful of functions in your view, this is not a big problem. 
the problem comes when you have more then a few hundreds. 

Best thing you can do is use 'native' (on $scope, or on the controllerAs) 
in your view. Having 2 variables on the scope is the best. However if you 
then have to add an watch in your controller you might put the function in 
the view as well. I think the toPercent(myVar) is well suited for use in 
the view. But this is an case to case thing you have to consider.

And your observation is right, on every digest cycle everything is 
rechecked on change, and if needed the view/html gets updated.

Does this answer your question, or did I confuse you even more? ;)

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to