I have a list of items, each of which has a unique id
$scope.arr = [{val:0,id:'a'},{val:1,id:'b'},{val:2,id:'c'}];
Each element is an absolute positioning according to their index $ index
<div class="item" ng-repeat="item in arr track by item.id"
ng-style="getAbsPos($index)" >{{item.id}}</div>
All I wanted - an exchange arr[0]and arr[2]in the array and displays a moving animation of this action. It is very difficult.
I assume this css will work as the list is tracked by id
.item{
transition:all 3000ms;
}
but somehow angular decides to move only one element and re-create another ( why ?! ). As a result, only one item is created.
= Question =
Is there a solution to solve this problem, so that both elements will be animated when they are replaced? Thank.
( , )
= . Plunker =
http://plnkr.co/edit/5AVhz81x3ZjzQFJKM0Iw?p=preview