-
Notifications
You must be signed in to change notification settings - Fork 27.5k
custom directive inside ng-repeat doesn't update once using track by index #15363
Comments
@gkalpak is great at explaining this behavior. We should put it in the docs somehow ... |
This is expected behavior for
So, by using That's what tracking by |
@gkalpak Thanks for the explaination! :) |
Using track by, any custom scope manipulation I did in a directive's link function, gets removed when the element is recycled. ie: a list of articles on a page, change up the filtering for the list and any instances that existed between the two now have custom scope properties removed that were generated in the original run of the link function. So... seems to me that angular isn't preserving the scope when using track by :( |
@ramseyfeng Thank you so much you saved me, It told me the whole day to fix this, when I removed the "track by index" it works fine. |
@olivezz np :) |
It seems the custom directive used in the ngRepeat with "track by index" will not got update?
I have create a plunk for this:
http://plnkr.co/edit/MBleogyCukFh4WEZWCts?p=preview
Once you remove the "track by index", everything works fine!
If it is not a bug, please guide me where the doc has introduced this part. Thanks!
The text was updated successfully, but these errors were encountered: