@@ -290,28 +290,32 @@ angular.module('ui.jq',[]).
290
290
291
291
return function uiJqLinkingFunction ( scope , elm , attrs ) {
292
292
293
- var linkOptions = [ ] ;
294
-
295
- // If ui-options are passed, merge (or override) them onto global defaults and pass to the jQuery method
296
- if ( attrs . uiOptions ) {
297
- linkOptions = scope . $eval ( '[' + attrs . uiOptions + ']' ) ;
298
- if ( angular . isObject ( options ) && angular . isObject ( linkOptions [ 0 ] ) ) {
299
- linkOptions [ 0 ] = angular . extend ( { } , options , linkOptions [ 0 ] ) ;
300
- }
301
- } else if ( options ) {
302
- linkOptions = [ options ] ;
303
- }
304
293
// If change compatibility is enabled, the form input's "change" event will trigger an "input" event
305
294
if ( attrs . ngModel && elm . is ( 'select,input,textarea' ) ) {
306
295
elm . bind ( 'change' , function ( ) {
307
296
elm . trigger ( 'input' ) ;
308
297
} ) ;
309
298
}
310
299
300
+ function createLinkOptions ( ) {
301
+ var linkOptions = [ ] ;
302
+
303
+ // If ui-options are passed, merge (or override) them onto global defaults and pass to the jQuery method
304
+ if ( attrs . uiOptions ) {
305
+ linkOptions = scope . $eval ( '[' + attrs . uiOptions + ']' ) ;
306
+ if ( angular . isObject ( options ) && angular . isObject ( linkOptions [ 0 ] ) ) {
307
+ linkOptions [ 0 ] = angular . extend ( { } , options , linkOptions [ 0 ] ) ;
308
+ }
309
+ } else if ( options ) {
310
+ linkOptions = [ options ] ;
311
+ }
312
+ return linkOptions ;
313
+ }
314
+
311
315
// Call jQuery method and pass relevant options
312
316
function callPlugin ( ) {
313
317
$timeout ( function ( ) {
314
- elm [ attrs . uiJq ] . apply ( elm , linkOptions ) ;
318
+ elm [ attrs . uiJq ] . apply ( elm , createLinkOptions ( ) ) ;
315
319
} , 0 , false ) ;
316
320
}
317
321
0 commit comments