Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

animation on wrong element in ng-repeat removed item #14501

Closed
arbixy opened this issue Apr 23, 2016 · 2 comments
Closed

animation on wrong element in ng-repeat removed item #14501

arbixy opened this issue Apr 23, 2016 · 2 comments

Comments

@arbixy
Copy link

arbixy commented Apr 23, 2016

When items in ng-repeat are tracked by index and animation is used on ng-leave the item is removed and then a wrong item is duplicated and the animation is applied on that duplication.

Here's a fresh example
This issue seems to be relatively old: stackoverflow

If one is using images and wants images with same sources to be included in the ng-repeat directive then track by $index is necessary.
Here's another thought on the matter as consequence to the behavior.
Imagine there is watcher in directive that keeps track of the ng-repeated items and actualities a css width removing item and animation may cause wrong behavior in that case.

@Narretz
Copy link
Contributor

Narretz commented Apr 25, 2016

This is unfortunate, but this seems like an expected side effect of track by $index and I'm not sure if it is fixable.

If you have duplicate items, you could add a unique identifier to them before you repeat over them (or use a track by function that does this).

@Narretz
Copy link
Contributor

Narretz commented Jan 9, 2018

This is an expected side effect of track by index.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants