Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Jan 1, 2019

Optimize ng-repeat with the Track by Feature in Angular

Take a look at the following ng-repeat code example:

<div ng-repeat="order in orders">

This is inefficient, as the DOM is rendered every time the list is written to the page. Add the track by feature, as shown below, by allowing the code to specify the id key instead of creating random ones and slowing the process.

<div ng-repeat="order in orders track by order.orderid ">
Srinath MS
Thanks for your registration, follow us on our social networks to keep up-to-date