Browse Source

Merge branch 'dev' of github.com:RubaXa/Sortable into dev

pull/404/merge
RubaXa 10 years ago
parent
commit
d5737ce9e7
  1. 15
      ng-sortable.js

15
ng-sortable.js

@ -64,11 +64,12 @@
// Export
return {
restrict: 'AC',
scope: { ngSortable: "=?" },
link: function (scope, $el, attrs) {
var el = $el[0],
ngSortable = attrs.ngSortable,
options = scope.$eval(ngSortable) || {},
options = scope.ngSortable || {},
source = getSource(el),
watchers = [],
sortable
;
@ -154,17 +155,20 @@
}));
$el.on('$destroy', function () {
angular.forEach(watchers, function (/** Function */unwatch) {
unwatch();
});
sortable.destroy();
watchers = null;
sortable = null;
nextSibling = null;
});
if (ngSortable && !/{|}/.test(ngSortable)) { // todo: ugly
angular.forEach([
'sort', 'disabled', 'draggable', 'handle', 'animation',
'onStart', 'onEnd', 'onAdd', 'onUpdate', 'onRemove', 'onSort'
], function (name) {
scope.$watch(ngSortable + '.' + name, function (value) {
watchers.push(scope.$watch('ngSortable.' + name, function (value) {
if (value !== void 0) {
options[name] = value;
@ -172,9 +176,8 @@
sortable.option(name, value);
}
}
}));
});
});
}
}
};
}]);

Loading…
Cancel
Save