Browse Source

Merge pull request #405 from just-boris/dev

ng-sortable: support configuration constant
pull/408/head
Lebedev Konstantin 9 years ago
parent
commit
0edd2a884c
  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