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

Commit 4ac4b0e

Browse files
author
Dean Sofer
committed
Merge branch 'options'
* options: fix(options): Corrected (PROPERLY) the way to update options in realtime fix(options): Corrected bug introduced by live-watching the options
2 parents 890ba8d + 6da809c commit 4ac4b0e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/sortable.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ angular.module('ui.sortable', []).value('uiSortableConfig',{}).directive('uiSort
1010
link: function(scope, element, attrs, ngModel) {
1111
var onReceive, onRemove, onStart, onStop, onUpdate, opts = {};
1212

13-
attrs.$observe('ui-sortable', function(){
14-
angular.extend(opts, uiSortableConfig, scope.$eval(attrs.uiSortable));
15-
});
13+
angular.extend(opts, uiSortableConfig);
14+
15+
scope.$watch(attrs.uiSortable, function(newVal, oldVal){
16+
angular.forEach(newVal, function(value, key){
17+
element.sortable('option', key, value);
18+
});
19+
}, true);
1620

1721
if (ngModel) {
1822

0 commit comments

Comments
 (0)