181
rated 0 times
[
182]
[
1]
/ answers: 1 / hits: 166643
/ 10 Years ago, mon, march 31, 2014, 12:00:00
I'm having difficulties understanding how the track by expression of ng-repeat in angularjs works. The documentation is very scarce: http://docs.angularjs.org/api/ng/directive/ngRepeat
Can you explain what the difference between those two snippets of code is in terms of databinding and other relevant aspects?
with: track by $index
<!--names is an array-->
<div ng-repeat=(key, value) in names track by $index>
<input ng-model=value[key]>
</div>
without (same output)
<!--names is an array-->
<div ng-repeat=(key, value) in names>
<input ng-model=value[key]>
</div>
More From » angularjs