@@ -4,7 +4,7 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
4
4
openClass : 'open'
5
5
} )
6
6
7
- . service ( 'dropdownService ' , [ '$document' , '$rootScope' , function ( $document , $rootScope ) {
7
+ . service ( 'uibDropdownService ' , [ '$document' , '$rootScope' , function ( $document , $rootScope ) {
8
8
var openScope = null ;
9
9
10
10
this . open = function ( dropdownScope ) {
@@ -65,7 +65,7 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
65
65
} ;
66
66
} ] )
67
67
68
- . controller ( 'DropdownController ' , [ '$scope' , '$attrs' , '$parse' , 'dropdownConfig' , 'dropdownService ' , '$animate' , '$position' , '$document' , '$compile' , '$templateRequest' , function ( $scope , $attrs , $parse , dropdownConfig , dropdownService , $animate , $position , $document , $compile , $templateRequest ) {
68
+ . controller ( 'UibDropdownController ' , [ '$scope' , '$attrs' , '$parse' , 'dropdownConfig' , 'uibDropdownService ' , '$animate' , '$position' , '$document' , '$compile' , '$templateRequest' , function ( $scope , $attrs , $parse , dropdownConfig , uibDropdownService , $animate , $position , $document , $compile , $templateRequest ) {
69
69
var self = this ,
70
70
scope = $scope . $new ( ) , // create a child scope so we are not polluting original one
71
71
templateScope ,
@@ -91,7 +91,7 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
91
91
}
92
92
93
93
appendToBody = angular . isDefined ( $attrs . dropdownAppendToBody ) ;
94
- keynavEnabled = angular . isDefined ( $attrs . keyboardNav ) ;
94
+ keynavEnabled = angular . isDefined ( $attrs . uibKeyboardNav ) ;
95
95
96
96
if ( appendToBody && self . dropdownMenu ) {
97
97
body . append ( self . dropdownMenu ) ;
@@ -207,7 +207,7 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
207
207
}
208
208
209
209
scope . focusToggleElement ( ) ;
210
- dropdownService . open ( scope ) ;
210
+ uibDropdownService . open ( scope ) ;
211
211
} else {
212
212
if ( self . dropdownMenuTemplateUrl ) {
213
213
if ( templateScope ) {
@@ -218,7 +218,7 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
218
218
self . dropdownMenu = newEl ;
219
219
}
220
220
221
- dropdownService . close ( scope ) ;
221
+ uibDropdownService . close ( scope ) ;
222
222
self . selectedOption = null ;
223
223
}
224
224
@@ -239,20 +239,20 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
239
239
scope . $on ( '$destroy' , offDestroy ) ;
240
240
} ] )
241
241
242
- . directive ( 'dropdown ' , function ( ) {
242
+ . directive ( 'uibDropdown ' , function ( ) {
243
243
return {
244
- controller : 'DropdownController ' ,
244
+ controller : 'UibDropdownController ' ,
245
245
link : function ( scope , element , attrs , dropdownCtrl ) {
246
246
dropdownCtrl . init ( element ) ;
247
247
element . addClass ( 'dropdown' ) ;
248
248
}
249
249
} ;
250
250
} )
251
251
252
- . directive ( 'dropdownMenu ' , function ( ) {
252
+ . directive ( 'uibDropdownMenu ' , function ( ) {
253
253
return {
254
254
restrict : 'AC' ,
255
- require : '?^dropdown ' ,
255
+ require : '?^uibDropdown ' ,
256
256
link : function ( scope , element , attrs , dropdownCtrl ) {
257
257
if ( ! dropdownCtrl ) {
258
258
return ;
@@ -268,10 +268,10 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
268
268
} ;
269
269
} )
270
270
271
- . directive ( 'keyboardNav ' , function ( ) {
271
+ . directive ( 'uibKeyboardNav ' , function ( ) {
272
272
return {
273
273
restrict : 'A' ,
274
- require : '?^dropdown ' ,
274
+ require : '?^uibDropdown ' ,
275
275
link : function ( scope , element , attrs , dropdownCtrl ) {
276
276
element . bind ( 'keydown' , function ( e ) {
277
277
if ( [ 38 , 40 ] . indexOf ( e . which ) !== - 1 ) {
@@ -307,9 +307,9 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
307
307
} ;
308
308
} )
309
309
310
- . directive ( 'dropdownToggle ' , function ( ) {
310
+ . directive ( 'uibDropdownToggle ' , function ( ) {
311
311
return {
312
- require : '?^dropdown ' ,
312
+ require : '?^uibDropdown ' ,
313
313
link : function ( scope , element , attrs , dropdownCtrl ) {
314
314
if ( ! dropdownCtrl ) {
315
315
return ;
@@ -343,3 +343,53 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
343
343
}
344
344
} ;
345
345
} ) ;
346
+
347
+ /* Depreciated dropdown below */
348
+
349
+ angular . module ( 'ui.bootstrap.dropdown' )
350
+ . value ( '$dropdownSuppressWarning' , false )
351
+ . directive ( 'dropdown' , [ '$log' , '$dropdownSuppressWarning' , function ( $log , $dropdownSuppressWarning ) {
352
+ return {
353
+ link : function ( scope , element , attrs , dropdownCtrl ) {
354
+ if ( ! $dropdownSuppressWarning ) {
355
+ $log . warn ( 'dropdown is now deprecated. Use uib-dropdown instead.' ) ;
356
+ }
357
+ }
358
+ } ;
359
+ } ] )
360
+
361
+ . directive ( 'dropdownMenu' , [ '$log' , '$dropdownSuppressWarning' , function ( $log , $dropdownSuppressWarning ) {
362
+ return {
363
+ restrict : 'AC' ,
364
+ require : '?^dropdown' ,
365
+ link : function ( scope , element , attrs , dropdownCtrl ) {
366
+ if ( ! $dropdownSuppressWarning ) {
367
+ $log . warn ( 'dropdown-menu is now deprecated. Use uib-dropdown-menu instead.' ) ;
368
+ }
369
+ }
370
+ } ;
371
+ } ] )
372
+
373
+ . directive ( 'keyboardNav' , [ '$log' , '$dropdownSuppressWarning' , function ( $log , $dropdownSuppressWarning ) {
374
+ return {
375
+ restrict : 'A' ,
376
+ require : '?^dropdown' ,
377
+ link : function ( scope , element , attrs , dropdownCtrl ) {
378
+ if ( ! $dropdownSuppressWarning ) {
379
+ $log . warn ( 'keyboard-nav is now deprecated. Use uib-keyboard-nav instead.' ) ;
380
+ }
381
+ }
382
+ } ;
383
+ } ] )
384
+
385
+ . directive ( 'dropdownToggle' , [ '$log' , '$dropdownSuppressWarning' , function ( $log , $dropdownSuppressWarning ) {
386
+ return {
387
+ require : '?^dropdown' ,
388
+ link : function ( scope , element , attrs , dropdownCtrl ) {
389
+ if ( ! $dropdownSuppressWarning ) {
390
+ $log . warn ( 'dropdown-toggle is now deprecated. Use uib-dropdown-toggle instead.' ) ;
391
+ }
392
+ }
393
+ } ;
394
+ } ] ) ;
395
+
0 commit comments