Joseph Joseph - 4 months ago 23
AngularJS Question

How do I create a read-only ng-repeat?

Initial rendering is very slow in

ng-repeat
. How do I create a read-only version of
ng-repeat
, such that when the array that you're iterating over changes, the rendered HTML does not change

Answer

A double colon makes things in Angular read-only. Use the following syntax:

<ul>
    <li ng-repeat="item in ::items">{{item.name}}</li>
</ul>
Comments