@@ -61,8 +61,13 @@ angular.module('ui.sortable', [])
6161 value = wrappers [ key ] ( value ) ;
6262 }
6363
64- if ( key === 'items' && ! value ) {
65- value = uiSortableConfig . items ;
64+ // patch the options that need to have values set
65+ if ( ! value ) {
66+ if ( key === 'items' ) {
67+ value = uiSortableConfig . items ;
68+ } else if ( key === 'ui-model-items' ) {
69+ value = uiSortableConfig . items ;
70+ }
6671 }
6772
6873 return value ;
@@ -89,7 +94,11 @@ angular.module('ui.sortable', [])
8994 angular . forEach ( oldVal , function ( oldValue , key ) {
9095 if ( ! newVal || ! ( key in newVal ) ) {
9196 if ( key in directiveOpts ) {
92- opts [ key ] = 'auto' ;
97+ if ( key === 'ui-floating' ) {
98+ opts [ key ] = 'auto' ;
99+ } else {
100+ opts [ key ] = patchSortableOption ( key , undefined ) ;
101+ }
93102 return ;
94103 }
95104
@@ -117,7 +126,7 @@ angular.module('ui.sortable', [])
117126 sortableWidgetInstance . floating = value ;
118127 }
119128
120- opts [ key ] = value ;
129+ opts [ key ] = patchSortableOption ( key , value ) ;
121130 return ;
122131 }
123132
@@ -154,8 +163,8 @@ angular.module('ui.sortable', [])
154163 function getPlaceholderExcludesludes ( element , placeholder ) {
155164 // exact match with the placeholder's class attribute to handle
156165 // the case that multiple connected sortables exist and
157- // the placehoilder option equals the class of sortable items
158- var notCssSelector = uiSortableConfig . items . replace ( / > / g, '' ) ;
166+ // the placeholder option equals the class of sortable items
167+ var notCssSelector = opts [ 'ui-model- items' ] . replace ( / [ ^ , ] * > / g, '' ) ;
159168 var excludes = element . find ( '[class="' + placeholder . attr ( 'class' ) + '"]:not(' + notCssSelector + ')' ) ;
160169 return excludes ;
161170 }
@@ -201,15 +210,16 @@ angular.module('ui.sortable', [])
201210 // we can't just do ui.item.index() because there it might have siblings
202211 // which are not items
203212 function getItemIndex ( ui ) {
204- return ui . item . parent ( ) . find ( uiSortableConfig . items )
213+ return ui . item . parent ( ) . find ( opts [ 'ui-model- items' ] )
205214 . index ( ui . item ) ;
206215 }
207216
208217 var opts = { } ;
209218
210219 // directive specific options
211220 var directiveOpts = {
212- 'ui-floating' : undefined
221+ 'ui-floating' : undefined ,
222+ 'ui-model-items' : uiSortableConfig . items
213223 } ;
214224
215225 var callbacks = {
0 commit comments