It seems that the UI-sortable (https://github.com/angular-ui/ui-sortable) plug in does not play well if there is a filter in the list that is being ng-repeated by angular. The drag and drops do not work as intended.
This is shown by these two fiddles:
First: Has filter - the drag and drop will not stay in place.
http://jsfiddle.net/Lvc0u55v/2886/
HTML:
<div ng-controller="Controller">
<ul ui-sortable="sortableOptions" id="test" ng-model="items">
<li class="line" ng-repeat="item in items | filter: myFilter">
{{item.name}}
</li>
</ul>
</div>
JS:
var myApp = angular.module('myApp',['ui.sortable']);
myApp.controller('Controller', ['$scope', function($scope) {
$scope.name = 'Superhero';
$scope.items = [
{name: 'TEST'},
{name: 'TEST2'},
{name: 'TEST3'},
{name: 'TEST4'},
{name: 'TEST5'},
{name: 'TEST6'},
{name: 'TEST7'},
{name: 'TEST8'}
]
$scope.myFilter = function (item) {
return item.name !== 'TEST';
};
$scope.sortableOptions = {
opacity: '0.8',
axis: 'y',
tolerance: 'pointer',
}
}]);
Second: Has no filter - works as intended.
JS SAME,
HTML:
<div ng-controller="Controller">
<ul ui-sortable="sortableOptions" id="test" ng-model="items">
<li class="line" ng-repeat="item in items">
{{item.name}}
</li>
</ul>
</div>
http://jsfiddle.net/Lvc0u55v/2887/
I will create an issue on their github repo as well, but if anyone has a work around that would be great!