Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.
/ Sortable Public archive
forked from SortableJS/Sortable

Commit f33927b

Browse files
committed
ng-sortable: support configuration constant
1 parent 851129a commit f33927b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ng-sortable.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626

2727
angular.module('ng-sortable', [])
2828
.constant('version', '0.3.7')
29-
.directive('ngSortable', ['$parse', function ($parse) {
29+
.constant('ngSortableConfig', {})
30+
.directive('ngSortable', ['$parse', 'ngSortableConfig', function ($parse, ngSortableConfig) {
3031
var removed,
3132
nextSibling;
3233

@@ -67,7 +68,7 @@
6768
scope: { ngSortable: "=?" },
6869
link: function (scope, $el, attrs) {
6970
var el = $el[0],
70-
options = scope.ngSortable || {},
71+
options = angular.extend(scope.ngSortable || {}, ngSortableConfig),
7172
source = getSource(el),
7273
watchers = [],
7374
sortable

st/app.js

+3
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@
148148

149149
// Angular example
150150
angular.module('todoApp', ['ng-sortable'])
151+
.constant('ngSortableConfig', {onEnd: function() {
152+
console.log('default onEnd()');
153+
}})
151154
.controller('TodoController', ['$scope', function ($scope) {
152155
$scope.todos = [
153156
{text: 'learn angular', done: true},

0 commit comments

Comments
 (0)