My understand is that in the following code, both bindings will lazily bind only once:
<li ng-repeat="item in ::items">{{::item.name}}</li>
However, in the following case will {{item.name}}
be updated every digest?
<li ng-repeat="item in ::items">{{item.name}}</li>
And how does one-time binding effect nested ng-repeat
s ?
<li ng-repeat="item in ::items">
<span ng-repeat="thing in item.things">{{thing.name}}</span>
</li>
<li ng-repeat="item in ::items">{{::item.name}}</li>
Both expressions will be one-time bound. Adding an item or changing an existing item's name will not be reflected.
Demo: http://plnkr.co/edit/53r8FCmcNK4MmM6Uzxp2?p=preview
<li ng-repeat="item in ::items">{{item.name}}</li>
First expression will be one-time bound. Adding an item will not be reflected. Changing an existing item's name will be reflected.
Demo: http://plnkr.co/edit/52wTEb8ze2FKRDDcS9Ow?p=preview
<li ng-repeat="item in ::items">
<span ng-repeat="thing in item.things">{{thing.name}}</span>
</li>
First expression will be one-time bound. Adding new item will not be reflected. Adding a new thing and changing existing thing's name will be reflected.
Demo: http://plnkr.co/edit/HkObhkJtUnFEHBAzFUmN?p=preview
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With