为什么选择垫在模态内部不起作用? onclick它显示了模态背后的选项 [英] why mat-select not working inside the modal ? onclick it shows options behind the Modal
本文介绍了为什么选择垫在模态内部不起作用? onclick它显示了模态背后的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
i使用了ngx-bootstrap模式.但是当我在其中使用mat-select时遇到了问题.垫选择选项显示在模态"后面. 我已经在此处解决方案中找到了这些解决方案,并且 这也是
i Used the ngx-bootstrap Modal. But i faced problem when i used the mat-select inside of it . The mat-select Options display behind the Modal . i already these solutions here solution and also this one
这是我的代码
<ng-template style="border: 0px ;z-index: 100" #editTemplate>
<mat-form-field>
<mat-select multiple placeholder="Multiple Cities" [(ngModel)]="currentCity" name="Paris" ariaLabel="cities[0]">
<mat-option *ngFor="let city of cities" [value]="city.value">
{{ city.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
<ng-template>
推荐答案
这是因为z索引冲突.
快速修复
修改模板 css/scss ,其中放置了模态和垫选择
Modify the template css/scss where the modal and mat-select are placed
.cdk-global-overlay-wrapper, .cdk-overlay-container {
z-index: 99999 !important;
}
这篇关于为什么选择垫在模态内部不起作用? onclick它显示了模态背后的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文