@@ -10,6 +10,10 @@ angular.module('ui.sortable', [])
10
10
function ( uiSortableConfig , $timeout , $log ) {
11
11
return {
12
12
require : '?ngModel' ,
13
+ scope : {
14
+ ngModel : '=ngModel' ,
15
+ uiSortable : '=uiSortable'
16
+ } ,
13
17
link : function ( scope , element , attrs , ngModel ) {
14
18
var savedNodes ;
15
19
@@ -56,7 +60,7 @@ angular.module('ui.sortable', [])
56
60
helper : null
57
61
} ;
58
62
59
- angular . extend ( opts , directiveOpts , uiSortableConfig , scope . $eval ( attrs . uiSortable ) ) ;
63
+ angular . extend ( opts , directiveOpts , uiSortableConfig , scope . uiSortable ) ;
60
64
61
65
if ( ! angular . element . fn || ! angular . element . fn . jquery ) {
62
66
$log . error ( 'ui.sortable: jQuery should be included before AngularJS!' ) ;
@@ -67,7 +71,7 @@ angular.module('ui.sortable', [])
67
71
68
72
// When we add or remove elements, we need the sortable to 'refresh'
69
73
// so it can find the new/removed elements.
70
- scope . $watch ( attrs . ngModel + ' .length', function ( ) {
74
+ scope . $watch ( 'ngModel .length', function ( ) {
71
75
// Timeout to let ng-repeat modify the DOM
72
76
$timeout ( function ( ) {
73
77
// ensure that the jquery-ui-sortable widget instance
@@ -256,7 +260,7 @@ angular.module('ui.sortable', [])
256
260
return inner ;
257
261
} ;
258
262
259
- scope . $watch ( attrs . uiSortable , function ( newVal /*, oldVal*/ ) {
263
+ scope . $watch ( ' uiSortable' , function ( newVal /*, oldVal*/ ) {
260
264
// ensure that the jquery-ui-sortable widget instance
261
265
// is still bound to the directive's element
262
266
if ( ! ! element . data ( 'ui-sortable' ) ) {
0 commit comments