HashKeyCopier
HashKeyCopier copied to clipboard
Is this still relevant in Angular 1.3
Hi @bennadel , amazing job on this solution, it helped me so much!
Sorry for the very wide question, but I was wondering if with all the performance improvements in Angular 1.3, they still haven't addressed this issue?
Thank you, Uri
@Urigo the hash-key-copier is no longer relevant as of AngularJS 1.2 (I believe). Now that the ng-repeat directive supports "track by"
variable in expression track by tracking_expression
... you don't need to copy IDs manually (with HashKeyCopier). That said, you will need to use the track by portion in order to get the performance benefits:
<li ng-repeat="friend in friends track by friend.id">..</li>
Hope that helps!
@Urigo and if you don't have an "id" (if the data isn't provided by a database), it looks like AngularJS also has a build in reference the uid that HashKeyCopier was actually copying:
<li ng-repeat="friend in friends track by $id( friend )">..</li>
This appears to copy the underlying hashKey (I think).