ng-sortable
Version:
Angular Library for Drag and Drop, supports Sortable and Draggable.
29 lines (23 loc) • 826 B
JavaScript
/*jshint undef: false, unused: false, indent: 2*/
/*global angular: false */
;
angular.module('demoApp').controller('HorizontalController', ['$scope', function ($scope) {
var i;
$scope.itemsList = {
items1: [],
items2: []
};
for (i = 0; i <= 5; i += 1) {
$scope.itemsList.items1.push({'Id': i, 'Label': 'Item A_' + i});
}
for (i = 0; i <= 5; i += 1) {
$scope.itemsList.items2.push({'Id': i, 'Label': 'Item B_' + i});
}
$scope.sortableOptions = {
containment: '#horizontal-container',
//restrict move across columns. move only within column.
accept: function (sourceItemHandleScope, destSortableScope) {
return sourceItemHandleScope.itemScope.sortableScope.$id === destSortableScope.$id;
}
};
}]);