From 5617c507cff82574eceb84ac0aeafca608980ecf Mon Sep 17 00:00:00 2001 From: livelazily Date: Wed, 6 Jan 2016 21:57:37 +0800 Subject: [PATCH] fix ng-repeat with other element in the same parent element --- ng-sortable.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ng-sortable.js b/ng-sortable.js index 87bdc58..2dd664e 100644 --- a/ng-sortable.js +++ b/ng-sortable.js @@ -121,6 +121,11 @@ } else { items.splice(newIndex, 0, items.splice(oldIndex, 1)[0]); + + // move ng-repeat comment node to right position + if (nextSibling.nodeType === Node.COMMENT_NODE) { + evt.from.insertBefore(nextSibling, evt.item.nextSibling); + } } scope.$apply();