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

Commit bcca460

Browse files
committed
Moved inside 'if (ngModel){}' any code that calls combineCallbacks and added $log.info() message in case ngModel is falsy.
Possibly closes #33 and #34.
1 parent db3561c commit bcca460

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/sortable.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
angular.module('ui.sortable', [])
77
.value('uiSortableConfig',{})
8-
.directive('uiSortable', [ 'uiSortableConfig',
9-
function(uiSortableConfig) {
8+
.directive('uiSortable', [ 'uiSortableConfig', '$log',
9+
function(uiSortableConfig, log) {
1010
return {
1111
require: '?ngModel',
1212
link: function(scope, element, attrs, ngModel) {
@@ -85,9 +85,6 @@ angular.module('ui.sortable', [])
8585
}
8686
};
8787

88-
}
89-
90-
9188
scope.$watch(attrs.uiSortable, function(newVal, oldVal){
9289
angular.forEach(newVal, function(value, key){
9390

@@ -113,8 +110,11 @@ angular.module('ui.sortable', [])
113110
// call apply after stop
114111
opts.stop = combineCallbacks( opts.stop, apply );
115112

116-
// Create sortable
113+
} else {
114+
log.info('ui.sortable: ngModel not provided!', element);
115+
}
117116

117+
// Create sortable
118118
element.sortable(opts);
119119
}
120120
};

0 commit comments

Comments
 (0)