Browse Source

ng-sortable: support configuration constant

pull/405/head
just-boris 10 years ago committed by just-boris
parent
commit
f33927bfd7
  1. 5
      ng-sortable.js
  2. 3
      st/app.js

5
ng-sortable.js

@ -26,7 +26,8 @@
angular.module('ng-sortable', [])
.constant('version', '0.3.7')
.directive('ngSortable', ['$parse', function ($parse) {
.constant('ngSortableConfig', {})
.directive('ngSortable', ['$parse', 'ngSortableConfig', function ($parse, ngSortableConfig) {
var removed,
nextSibling;
@ -67,7 +68,7 @@
scope: { ngSortable: "=?" },
link: function (scope, $el, attrs) {
var el = $el[0],
options = scope.ngSortable || {},
options = angular.extend(scope.ngSortable || {}, ngSortableConfig),
source = getSource(el),
watchers = [],
sortable

3
st/app.js

@ -148,6 +148,9 @@
// Angular example
angular.module('todoApp', ['ng-sortable'])
.constant('ngSortableConfig', {onEnd: function() {
console.log('default onEnd()');
}})
.controller('TodoController', ['$scope', function ($scope) {
$scope.todos = [
{text: 'learn angular', done: true},

Loading…
Cancel
Save