I'm a little flummoxed when it comes to animating ng-move in an ng-repeat. If I move an array item from 3 to 7 for instance, items 4-7 get shifted up and they animate. However the actual item I moved from 3 and placed in position 7, does not. Here's a plunkr demonstrating my issue.
当涉及到在一个ng-repeat中动画ng-move时,我有点不知所措。例如,如果我将数组项从3移动到7,那么4-7项就会向上移动,它们就会有动画效果。然而,我从3号位置移动到7号位置的实际项目却没有。这是我的问题。
http://plnkr.co/edit/4yRkLWbsU57YxrYOrWUQ?p=preview
http://plnkr.co/edit/4yRkLWbsU57YxrYOrWUQ?p=preview
Moving item 7 to 3, however, works as I expect, animating the single moved item, and not the items that have been pushed down.
但是,将项目7移动到3,就像我期望的那样,对单个移动的项进行动画处理,而不是被向下推的项。
This is not very useful for showing a user what moved. How should someone properly animate an ng-move?
这对于向用户显示移动的内容不是很有用。一个人应该如何正确地激活一个ng-move?
2 个解决方案
#1
1
@tasseKat has an excellent answer, which explains the behavior you observed: https://*.com/a/27616435/1652643
@tasseKat给出了一个很好的答案,解释了你观察到的行为:https://*.com/a/27616435/1652643
However, his solution is not as simple as you would wish... but so far I haven't found anything better.
然而,他的解决方案并不像你希望的那么简单……但到目前为止我还没有找到更好的。
#2
0
The correct syntax is
正确的语法是
arrayVar.splice(to, 0, arrayVar.splice(from, 1));
To remove and return an element at the index i
of array arr
, use arr.splice(i, 1)
,
要删除并返回数组arr的索引i处的元素,请使用arr。拼接(我,1),
#1
1
@tasseKat has an excellent answer, which explains the behavior you observed: https://*.com/a/27616435/1652643
@tasseKat给出了一个很好的答案,解释了你观察到的行为:https://*.com/a/27616435/1652643
However, his solution is not as simple as you would wish... but so far I haven't found anything better.
然而,他的解决方案并不像你希望的那么简单……但到目前为止我还没有找到更好的。
#2
0
The correct syntax is
正确的语法是
arrayVar.splice(to, 0, arrayVar.splice(from, 1));
To remove and return an element at the index i
of array arr
, use arr.splice(i, 1)
,
要删除并返回数组arr的索引i处的元素,请使用arr。拼接(我,1),