Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

angularjs

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

like image 253
Joseph Avatar asked Dec 15 '22 20:12

Joseph


1 Answers

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

<ul>
    <li ng-repeat="item in ::items">{{item.name}}</li>
</ul>
like image 196
Joseph Avatar answered Feb 01 '23 16:02

Joseph