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

Commit 6da809c

Browse files
author
Dean Sofer
committed
fix(options): Corrected (PROPERLY) the way to update options in realtime
1 parent d4fe96f commit 6da809c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/sortable.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +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(newVal){
14-
angular.extend(opts, uiSortableConfig, newVal);
15-
angular.forEach(opts, function(value, key){
13+
angular.extend(opts, uiSortableConfig);
14+
15+
scope.$watch(attrs.uiSortable, function(newVal, oldVal){
16+
angular.forEach(newVal, function(value, key){
1617
element.sortable('option', key, value);
1718
});
18-
});
19+
}, true);
1920

2021
if (ngModel) {
2122

0 commit comments

Comments
 (0)