Sanket Virani
Sanket Virani

Reputation: 23

angularjs ng-repeat is very slow with heavy data

I am working with one board system. In which there are cards need to display as well are card can be drag and drop into the board.

There are n number of row and column possible in board and card can be drag and dropped to any row and column.

So I have implemented it with nested ng-repeat and it is working correctly.

but when there are more then 300 cards are on board then it is taking to much time to load around 8000ms to 9000ms.

as data is more and used nested ng-repeat so there are so many iterations.

lazy load is not possible due to need to display all cards in single board.

So in this case how can I improve performance to render board with ng-repeat or any other alternatives.

Any help would be appreciated.

Thanks

Upvotes: 2

Views: 4499

Answers (1)

Ardit
Ardit

Reputation: 376

One way to improve ng-repeat performance is using it with track by:

<div ng-repeat="item in array track by item.property"> </div>

Or try this if the item property isn't unique:

<div ng-repeat="item in array track by $index"> </div>

Upvotes: 3

Related Questions