Do bindings nested inside of a lazy one-time ng-repeat binding bind just once?

AngularjsBindingAngularjs Ng-Repeat

Angularjs Problem Overview


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-repeats ?

<li ng-repeat="item in ::items">
  <span ng-repeat="thing in item.things">{{thing.name}}</span>
</li>

Angularjs Solutions


Solution 1 - Angularjs

Scenario 1:

<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

Scenario 2:

<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

Scenario 3:

<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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGil BirmanView Question on Stackoverflow
Solution 1 - AngularjstasseKATTView Answer on Stackoverflow