简体   繁体   中英

Angular 2 ng-bootstrap open multiple models

I am trying to open modal on top of another model using ng-bootstrap. Model is open as expected but the modal-backdrop of the second model is behind the fist model. 在此处输入图片说明

Models have opend as the document . Nothing special has done.

I managed to get this work as just by adding following css code.

.modal:nth-of-type(2) {
    z-index: 1051 !important;
}
.modal-backdrop:nth-of-type(2) {
    z-index: 1050 !important;
}

.modal:nth-of-type(3) {
    z-index: 1052 !important;
}
.modal-backdrop:nth-of-type(3) {
    z-index: 1051 !important;
} 

I want to open 3 nested models. That's why I added nth-of-type(2) and nth-of-type(3)

add this style to your code:

.modal {
    background: rgba(0,0,0,0.3);
}

and then disable modal-backdrop by setting the display to 'none'

OR

set aria-hidden="false" in your template inside div that contain mdbModal property

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM