Browse Source

Merge pull request #364 from ha-D/dev

Use isolated scope with two-way binding in ng-sortable
pull/360/merge
Lebedev Konstantin 10 years ago
parent
commit
cd4238ead8
  1. 8
      ng-sortable.js

8
ng-sortable.js

@ -64,10 +64,10 @@
// 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
@ -164,12 +164,11 @@
nextSibling = null;
});
if (ngSortable && !/{|}/.test(ngSortable)) { // todo: ugly
angular.forEach([
'sort', 'disabled', 'draggable', 'handle', 'animation',
'onStart', 'onEnd', 'onAdd', 'onUpdate', 'onRemove', 'onSort'
], function (name) {
watchers.push(scope.$watch(ngSortable + '.' + name, function (value) {
watchers.push(scope.$watch('ngSortable.' + name, function (value) {
if (value !== void 0) {
options[name] = value;
@ -180,7 +179,6 @@
}));
});
}
}
};
}]);
});

Loading…
Cancel
Save