|
|
@ -5,6 +5,8 @@ |
|
|
|
angular.module('ng-sortable', []) |
|
|
|
angular.module('ng-sortable', []) |
|
|
|
.constant('$version', '0.1.0') |
|
|
|
.constant('$version', '0.1.0') |
|
|
|
.directive('ngSortable', ['$parse', '$rootScope', function ($parse, $rootScope) { |
|
|
|
.directive('ngSortable', ['$parse', '$rootScope', function ($parse, $rootScope) { |
|
|
|
|
|
|
|
"use strict"; |
|
|
|
|
|
|
|
|
|
|
|
var removed; |
|
|
|
var removed; |
|
|
|
|
|
|
|
|
|
|
|
function getSource(el) { |
|
|
|
function getSource(el) { |
|
|
@ -72,7 +74,7 @@ angular.module('ng-sortable', []) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var sortable = Sortable.create(el, Object.keys(options).reduce(function(opts, name) { |
|
|
|
var sortable = Sortable.create(el, Object.keys(options).reduce(function (opts, name) { |
|
|
|
opts[name] = opts[name] || options[name]; |
|
|
|
opts[name] = opts[name] || options[name]; |
|
|
|
return opts; |
|
|
|
return opts; |
|
|
|
}, { |
|
|
|
}, { |
|
|
@ -80,7 +82,7 @@ angular.module('ng-sortable', []) |
|
|
|
$rootScope.$broadcast('sortable:start', sortable); |
|
|
|
$rootScope.$broadcast('sortable:start', sortable); |
|
|
|
options.onStart(); |
|
|
|
options.onStart(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
onEnd:function () { |
|
|
|
onEnd: function () { |
|
|
|
$rootScope.$broadcast('sortable:end', sortable); |
|
|
|
$rootScope.$broadcast('sortable:end', sortable); |
|
|
|
options.onEnd(); |
|
|
|
options.onEnd(); |
|
|
|
}, |
|
|
|
}, |
|
|
|