删除时的角度ng重复动画

时间:2023-01-13 19:41:20

I am trying to create an add\remove animation in an ng-repeat (with css transitions). For some reason the fade out effect always happens at the bottom of the list and not on the item you choose to delete (for example try deleting the first item , the effect shows at the bottom) . Here's a plunkr http://plnkr.co/edit/XdGHKhf5z5BQMaYk1Naz?p=preview

我试图在ng-repeat(使用css过渡)中创建一个add \ remove动画。由于某种原因,淡出效果始终发生在列表的底部而不是您选择删除的项目上(例如,尝试删除第一个项目,效果显示在底部)。这是一个傻瓜http://plnkr.co/edit/XdGHKhf5z5BQMaYk1Naz?p=preview

Any thoughts ?

有什么想法吗 ?

2 个解决方案

#1


8  

If you remove

如果你删除

track by $index

, then it should be all right. just:

那应该没问题。只是:

<div ng-repeat="item in items" class="repeat-item">

#2


3  

Use a simple ng-repeat: "item in items" in this way works fine.

使用简单的ng-repeat:“项目中的项目”以这种方式正常工作。

Check this plunker

检查这个plunker

#1


8  

If you remove

如果你删除

track by $index

, then it should be all right. just:

那应该没问题。只是:

<div ng-repeat="item in items" class="repeat-item">

#2


3  

Use a simple ng-repeat: "item in items" in this way works fine.

使用简单的ng-repeat:“项目中的项目”以这种方式正常工作。

Check this plunker

检查这个plunker