javascript - Swapping elements in Angular JS -


i curious appropriate way animate , swap elements using angular. have two-dimensional array has nested ng-repeat create table. end goal have 2 elements in table swap places using animation, hover on eachother's positions.

i have function swaps position of 2 jquery elements, doesn't update array , angular array no longer synced displayed. find animation hangs little when moving elements between rows whereas columns smooth. ie. [0][0] -> [0][1] smooth , [0][0] -> [1][0] hangs

jquery.fn.swapwith = function (to, callback) {             animating = true;         thispos = this.position();         topos = to.position();         $.when(this.animate({             top: topos.top,             left: topos.left         }, 300),             to.animate({                 top: thispos.top,                 left: thispos.left             }, 300)).done(function () {                 animating = false;                 if (callback) {                     callback();                 }             });       }; 

i've found codepen pretty nice, not quite i'm looking for. http://codepen.io/daleyjem/pen/xbzypy there standard way of handling in angular?

to put in more simple terms: if want array[0][0] swap positions array[0][1] , have $scope object update appropriately, how should it? same array[0][0] array[1][0]?

edit: should mention, have noticed setting elements equal eachother update table appropriately. problem being lack of animation. example:

a = [0][1] b = [0][0]  [0][1] = b [0][0] = 


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -