As we all know AngularJS uses the simplest form of $watch
when we bind to variable in template like this {{ $ctrl.obj }}
.
It should compare value of $ctrl.obj
by reference, but if I mutate $ctrl.obj
the change is reflected in view. The reference doesn't changed, so why?
AngularJS template binding to object
276 views Asked by user3852961 At
1
When we use brackets (
{{}}
) angular does not use anywatch
(ers) for detecting changes on the expression placed inside them. Instead this expression is dirty checked and refreshed in every$digest
cycle, even if it is not necessary.See this post: AngularJS : Why ng-bind is better than {{}} in angular?