@@ -107,14 +107,8 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
107
107
} ] )
108
108
109
109
. directive ( 'uibModalWindow' , [
110
- '$uibModalStack' , '$q' , '$animate' , '$injector' ,
111
- function ( $modalStack , $q , $animate , $injector ) {
112
- var $animateCss = null ;
113
-
114
- if ( $injector . has ( '$animateCss' ) ) {
115
- $animateCss = $injector . get ( '$animateCss' ) ;
116
- }
117
-
110
+ '$uibModalStack' , '$q' , '$animate' , '$animateCss' ,
111
+ function ( $modalStack , $q , $animate , $animateCss ) {
118
112
return {
119
113
scope : {
120
114
index : '@'
@@ -160,13 +154,9 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
160
154
var animationPromise = null ;
161
155
162
156
if ( attrs . modalInClass ) {
163
- if ( $animateCss ) {
164
- animationPromise = $animateCss ( element , {
165
- addClass : attrs . modalInClass
166
- } ) . start ( ) ;
167
- } else {
168
- animationPromise = $animate . addClass ( element , attrs . modalInClass ) ;
169
- }
157
+ animationPromise = $animateCss ( element , {
158
+ addClass : attrs . modalInClass
159
+ } ) . start ( ) ;
170
160
171
161
scope . $on ( $modalStack . NOW_CLOSING_EVENT , function ( e , setIsAsync ) {
172
162
var done = setIsAsync ( ) ;
@@ -230,22 +220,14 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
230
220
} )
231
221
232
222
. factory ( '$uibModalStack' , [
233
- '$animate' , '$timeout' , '$document' , '$compile' , '$rootScope' ,
223
+ '$animate' , '$animateCss' , '$ timeout', '$document' , '$compile' , '$rootScope' ,
234
224
'$q' ,
235
- '$injector' ,
236
225
'$$multiMap' ,
237
226
'$$stackedMap' ,
238
- function ( $animate , $timeout , $document , $compile , $rootScope ,
227
+ function ( $animate , $animateCss , $timeout , $document , $compile , $rootScope ,
239
228
$q ,
240
- $injector ,
241
229
$$multiMap ,
242
230
$$stackedMap ) {
243
- var $animateCss = null ;
244
-
245
- if ( $injector . has ( '$animateCss' ) ) {
246
- $animateCss = $injector . get ( '$animateCss' ) ;
247
- }
248
-
249
231
var OPENED_MODAL_CLASS = 'modal-open' ;
250
232
251
233
var backdropDomEl , backdropScope ;
@@ -350,15 +332,12 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
350
332
}
351
333
afterAnimating . done = true ;
352
334
353
- if ( $animateCss ) {
354
- $animateCss ( domEl , {
355
- event : 'leave'
356
- } ) . start ( ) . then ( function ( ) {
357
- domEl . remove ( ) ;
358
- } ) ;
359
- } else {
360
- $animate . leave ( domEl ) ;
361
- }
335
+ $animateCss ( domEl , {
336
+ event : 'leave'
337
+ } ) . start ( ) . then ( function ( ) {
338
+ domEl . remove ( ) ;
339
+ } ) ;
340
+
362
341
scope . $destroy ( ) ;
363
342
if ( done ) {
364
343
done ( ) ;
@@ -441,7 +420,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
441
420
angularBackgroundDomEl . attr ( 'modal-animation' , 'true' ) ;
442
421
}
443
422
backdropDomEl = $compile ( angularBackgroundDomEl ) ( backdropScope ) ;
444
- appendToElement . append ( backdropDomEl ) ;
423
+ $animate . enter ( backdropDomEl , appendToElement ) ;
445
424
}
446
425
447
426
var angularDomEl = angular . element ( '<div uib-modal-window="modal-window"></div>' ) ;
@@ -460,8 +439,10 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
460
439
var modalDomEl = $compile ( angularDomEl ) ( modal . scope ) ;
461
440
openedWindows . top ( ) . value . modalDomEl = modalDomEl ;
462
441
openedWindows . top ( ) . value . modalOpener = modalOpener ;
463
- appendToElement . append ( modalDomEl ) ;
464
- appendToElement . addClass ( modalBodyClass ) ;
442
+ $animate . enter ( modalDomEl , appendToElement )
443
+ . then ( function ( ) {
444
+ $animate . addClass ( appendToElement , modalBodyClass ) ;
445
+ } ) ;
465
446
466
447
$modalStack . clearFocusListCache ( ) ;
467
448
} ;
0 commit comments