Reputation: 83
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?
Upvotes: 1
Views: 230
Reputation: 14958
When we use brackets ({{}}
) angular does not use any watch
(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?
Upvotes: 0