You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This code will lead to "10 $digest iterations" error (plunkr):
<div ng-repeat="a in [[]]">
<div ng-repeat="b in a">
</div>
</div>
The difference is that, although the array object is created on every $digest cycle, the comparison goes 1 level deep, comparing the items in last and current arrays, not the arrays themselves. When we go nested with N levels, we need to compare N levels of arrays down, so that the array objects themselves didn't matter, only the actual objects inside.
Why is this needed? Try to write an array filter that works with array-of-arrays, keeping all returned array objects the same between $digest iterations.
Real-world example: Suppose need to show items in groups of 3. We write a nested ng-repeat and simple splitter filter -> 10 $digest iterations error -> minus 3 hours of life and a much deeper understanding of Angular insides.
This code works great:
This code will lead to "10 $digest iterations" error (plunkr):
The difference is that, although the array object is created on every $digest cycle, the comparison goes 1 level deep, comparing the items in last and current arrays, not the arrays themselves. When we go nested with N levels, we need to compare N levels of arrays down, so that the array objects themselves didn't matter, only the actual objects inside.
Why is this needed? Try to write an array filter that works with array-of-arrays, keeping all returned array objects the same between $digest iterations.
Real-world example: Suppose need to show items in groups of 3. We write a nested ng-repeat and simple splitter filter -> 10 $digest iterations error -> minus 3 hours of life and a much deeper understanding of Angular insides.
This might be related to #1389, not sure.
The text was updated successfully, but these errors were encountered: