Browse Source

#664: .on('') -> scope.on('')

pull/699/head
RubaXa 9 years ago
parent
commit
e53002892f
  1. 34
      ng-sortable.js

34
ng-sortable.js

@ -126,7 +126,24 @@
scope.$apply();
}
function _destroy() {
scope.off('$destroy', _destroy);
angular.forEach(watchers, function (/** Function */unwatch) {
unwatch();
});
sortable.destroy();
el[expando] = null;
el = null;
watchers = null;
sortable = null;
nextSibling = null;
}
// Initialization
sortable = Sortable.create(el, Object.keys(options).reduce(function (opts, name) {
opts[name] = opts[name] || options[name];
return opts;
@ -157,20 +174,7 @@
}
}));
$el.on('$destroy', function () {
angular.forEach(watchers, function (/** Function */unwatch) {
unwatch();
});
sortable.destroy();
el[expando] = null;
el = null;
watchers = null;
sortable = null;
nextSibling = null;
});
// Create watchers for `options`
angular.forEach([
'sort', 'disabled', 'draggable', 'handle', 'animation', 'group', 'ghostClass', 'filter',
'onStart', 'onEnd', 'onAdd', 'onUpdate', 'onRemove', 'onSort', 'onMove', 'onClone'
@ -185,6 +189,8 @@
}
}));
});
scope.on('$destroy', _destroy);
}
};
}]);

Loading…
Cancel
Save