Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 82a0b85

Browse files
committed
Allow for updating options
I $observe the attrs for changes and update the options. This enables you to update the options on the fly. Example being enabling and disabling the ability to sort, during an "edit" action.
1 parent d091d89 commit 82a0b85

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/sortable.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ angular.module('ui.sortable', []).value('uiSortableConfig',{}).directive('uiSort
88
return {
99
require: '?ngModel',
1010
link: function(scope, element, attrs, ngModel) {
11-
var onReceive, onRemove, onStart, onStop, onUpdate, opts;
11+
var onReceive, onRemove, onStart, onStop, onUpdate, opts = {};
1212

13-
opts = angular.extend({}, uiSortableConfig, scope.$eval(attrs.uiSortable));
13+
attrs.$observe('ui-sortable', function(){
14+
opts = angular.extend({}, uiSortableConfig, scope.$eval(attrs.uiSortable));
15+
});
1416

1517
if (ngModel) {
1618

0 commit comments

Comments
 (0)