@@ -106,8 +106,7 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
106
106
. directive ( 'uibModalBackdrop' , [ '$animate' , '$injector' , '$uibModalStack' ,
107
107
function ( $animate , $injector , $modalStack ) {
108
108
return {
109
- replace : true ,
110
- templateUrl : 'uib/template/modal/backdrop.html' ,
109
+ restrict : 'A' ,
111
110
compile : function ( tElement , tAttrs ) {
112
111
tElement . addClass ( tAttrs . backdropClass ) ;
113
112
return linkFn ;
@@ -136,13 +135,12 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
136
135
scope : {
137
136
index : '@'
138
137
} ,
139
- replace : true ,
138
+ restrict : 'A' ,
140
139
transclude : true ,
141
140
templateUrl : function ( tElement , tAttrs ) {
142
141
return tAttrs . templateUrl || 'uib/template/modal/window.html' ;
143
142
} ,
144
143
link : function ( scope , element , attrs ) {
145
- element . addClass ( attrs . windowClass || '' ) ;
146
144
element . addClass ( attrs . windowTopClass || '' ) ;
147
145
scope . size = attrs . size ;
148
146
@@ -167,12 +165,9 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
167
165
168
166
// Deferred object that will be resolved when this modal is render.
169
167
var modalRenderDeferObj = $q . defer ( ) ;
170
- // Observe function will be called on next digest cycle after compilation, ensuring that the DOM is ready.
171
- // In order to use this way of finding whether DOM is ready, we need to observe a scope property used in modal's template.
172
- attrs . $observe ( 'modalRender' , function ( value ) {
173
- if ( value === 'true' ) {
174
- modalRenderDeferObj . resolve ( ) ;
175
- }
168
+ // Resolve render promise post-digest
169
+ scope . $$postDigest ( function ( ) {
170
+ modalRenderDeferObj . resolve ( ) ;
176
171
} ) ;
177
172
178
173
modalRenderDeferObj . promise . then ( function ( ) {
@@ -477,7 +472,16 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
477
472
backdropScope . modalOptions = modal ;
478
473
backdropScope . index = currBackdropIndex ;
479
474
backdropDomEl = angular . element ( '<div uib-modal-backdrop="modal-backdrop"></div>' ) ;
480
- backdropDomEl . attr ( 'backdrop-class' , modal . backdropClass ) ;
475
+ backdropDomEl . attr ( {
476
+ 'class' : 'modal-backdrop' ,
477
+ 'ng-style' : '{\'z-index\': 1040 + (index && 1 || 0) + index*10}' ,
478
+ 'uib-modal-animation-class' : 'fade' ,
479
+ 'modal-in-class' : 'in'
480
+ } ) ;
481
+ if ( modal . backdropClass ) {
482
+ backdropDomEl . addClass ( modal . backdropClass ) ;
483
+ }
484
+
481
485
if ( modal . animation ) {
482
486
backdropDomEl . attr ( 'modal-animation' , 'true' ) ;
483
487
}
@@ -493,13 +497,22 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
493
497
topModalIndex = previousTopOpenedModal ? parseInt ( previousTopOpenedModal . value . modalDomEl . attr ( 'index' ) , 10 ) + 1 : 0 ;
494
498
var angularDomEl = angular . element ( '<div uib-modal-window="modal-window"></div>' ) ;
495
499
angularDomEl . attr ( {
500
+ 'class' : 'modal' ,
496
501
'template-url' : modal . windowTemplateUrl ,
497
- 'window-class' : modal . windowClass ,
498
502
'window-top-class' : modal . windowTopClass ,
503
+ 'role' : 'dialog' ,
499
504
'size' : modal . size ,
500
505
'index' : topModalIndex ,
501
- 'animate' : 'animate'
506
+ 'animate' : 'animate' ,
507
+ 'ng-style' : '{\'z-index\': 1050 + index*10, display: \'block\'}' ,
508
+ 'tabindex' : - 1 ,
509
+ 'uib-modal-animation-class' : 'fade' ,
510
+ 'modal-in-class' : 'in'
502
511
} ) . html ( modal . content ) ;
512
+ if ( modal . windowClass ) {
513
+ angularDomEl . addClass ( modal . windowClass ) ;
514
+ }
515
+
503
516
if ( modal . animation ) {
504
517
angularDomEl . attr ( 'modal-animation' , 'true' ) ;
505
518
}
0 commit comments