1
- angular . module ( 'ui.bootstrap.modal' , [ 'ui.bootstrap.transition' ] )
1
+ angular . module ( 'ui.bootstrap.modal' , [ ] )
2
2
3
3
/**
4
4
* A helper, internal data structure that acts as a map but also allows getting / removing
@@ -155,8 +155,8 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition'])
155
155
} ;
156
156
} )
157
157
158
- . factory ( '$modalStack' , [ '$transition ' , '$timeout' , '$document' , '$compile' , '$rootScope' , '$$stackedMap' ,
159
- function ( $transition , $timeout , $document , $compile , $rootScope , $$stackedMap ) {
158
+ . factory ( '$modalStack' , [ '$animate ' , '$timeout' , '$document' , '$compile' , '$rootScope' , '$$stackedMap' ,
159
+ function ( $animate , $timeout , $document , $compile , $rootScope , $$stackedMap ) {
160
160
161
161
var OPENED_MODAL_CLASS = 'modal-open' ;
162
162
@@ -190,8 +190,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition'])
190
190
openedWindows . remove ( modalInstance ) ;
191
191
192
192
//remove window DOM element
193
- removeAfterAnimate ( modalWindow . modalDomEl , modalWindow . modalScope , 300 , function ( ) {
194
- modalWindow . modalScope . $destroy ( ) ;
193
+ removeAfterAnimate ( modalWindow . modalDomEl , modalWindow . modalScope , function ( ) {
195
194
body . toggleClass ( OPENED_MODAL_CLASS , openedWindows . length ( ) > 0 ) ;
196
195
checkRemoveBackdrop ( ) ;
197
196
} ) ;
@@ -201,28 +200,22 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition'])
201
200
//remove backdrop if no longer needed
202
201
if ( backdropDomEl && backdropIndex ( ) == - 1 ) {
203
202
var backdropScopeRef = backdropScope ;
204
- removeAfterAnimate ( backdropDomEl , backdropScope , 150 , function ( ) {
205
- backdropScopeRef . $destroy ( ) ;
203
+ removeAfterAnimate ( backdropDomEl , backdropScope , function ( ) {
206
204
backdropScopeRef = null ;
207
205
} ) ;
208
206
backdropDomEl = undefined ;
209
207
backdropScope = undefined ;
210
208
}
211
209
}
212
210
213
- function removeAfterAnimate ( domEl , scope , emulateTime , done ) {
211
+ function removeAfterAnimate ( domEl , scope , done ) {
214
212
// Closing animation
215
213
scope . animate = false ;
216
214
217
- var transitionEndEventName = $transition . transitionEndEventName ;
218
- if ( transitionEndEventName ) {
215
+ if ( $animate . enabled ( ) ) {
219
216
// transition out
220
- var timeout = $timeout ( afterAnimating , emulateTime ) ;
221
-
222
- domEl . bind ( transitionEndEventName , function ( ) {
223
- $timeout . cancel ( timeout ) ;
224
- afterAnimating ( ) ;
225
- scope . $apply ( ) ;
217
+ domEl . one ( '$animate:close' , function closeFn ( ) {
218
+ $rootScope . $evalAsync ( afterAnimating ) ;
226
219
} ) ;
227
220
} else {
228
221
// Ensure this call is async
@@ -236,6 +229,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition'])
236
229
afterAnimating . done = true ;
237
230
238
231
domEl . remove ( ) ;
232
+ scope . $destroy ( ) ;
239
233
if ( done ) {
240
234
done ( ) ;
241
235
}
0 commit comments