Animating ng-move in AngularJS ngRepeat is animating the wrong items

后端 未结 2 966
醉话见心
醉话见心 2021-02-14 10:43

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

相关标签:
2条回答
  • 2021-02-14 11:06

    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),

    0 讨论(0)
  • 2021-02-14 11:17

    @tasseKat has an excellent answer, which explains the behavior you observed: https://stackoverflow.com/a/27616435/1652643

    However, his solution is not as simple as you would wish... but so far I haven't found anything better.

    0 讨论(0)
提交回复
热议问题