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

Commit d28a5e6

Browse files
author
AngularUI (via TravisCI)
committed
Travis commit : build 201
1 parent 5f39fea commit d28a5e6

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-sortable",
3-
"version": "0.12.2",
3+
"version": "0.12.3",
44
"main": "./sortable.js",
55
"dependencies": {
66
"angular": "~1.2.x",

sortable.js

+18-11
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ angular.module('ui.sortable', [])
4444
scope.$watch(attrs.ngModel+'.length', function() {
4545
// Timeout to let ng-repeat modify the DOM
4646
$timeout(function() {
47+
// ensure that the jquery-ui-sortable widget instance
48+
// is still bound to the directive's element
4749
if (!!element.data('ui-sortable')) {
4850
element.sortable('refresh');
4951
}
@@ -176,18 +178,23 @@ angular.module('ui.sortable', [])
176178
};
177179

178180
scope.$watch(attrs.uiSortable, function(newVal /*, oldVal*/) {
179-
angular.forEach(newVal, function(value, key) {
180-
if(callbacks[key]) {
181-
if( key === 'stop' ){
182-
// call apply after stop
183-
value = combineCallbacks(
184-
value, function() { scope.$apply(); });
181+
// ensure that the jquery-ui-sortable widget instance
182+
// is still bound to the directive's element
183+
if (!!element.data('ui-sortable')) {
184+
angular.forEach(newVal, function(value, key) {
185+
if(callbacks[key]) {
186+
if( key === 'stop' ){
187+
// call apply after stop
188+
value = combineCallbacks(
189+
value, function() { scope.$apply(); });
190+
}
191+
// wrap the callback
192+
value = combineCallbacks(callbacks[key], value);
185193
}
186-
// wrap the callback
187-
value = combineCallbacks(callbacks[key], value);
188-
}
189-
element.sortable('option', key, value);
190-
});
194+
195+
element.sortable('option', key, value);
196+
});
197+
}
191198
}, true);
192199

193200
angular.forEach(callbacks, function(value, key) {

sortable.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)