I am new to Angularjs and my app(built with Angular & Rails) is taking too much time to load the images/data. So I plan to optimize the code. Here is very quick and short question. What is the best way to use ng-repeat
? I planned to use track by
in ng-repeat.
In my $scope.attributes
I am getting thousands of data from server. In each there are many fields. But I wanted to use single field from those. SO I tried something like this:
<div ng-repeat="attribute in attributes track by attribute.name" >
<li> {{attribute.name}} </li>
</div>
Is this correct way? I have seen many examples everywhere use track by task.id
So Can I use any specific
field name instead of id
? Can I use filter also? what is the meaning of $$hashkey
approach? I wanted to load images and it takes more time. Please want Experts advice.