angular - 为什么 mat-select 不能在模态内工作? onclick 它显示模态后面的选项

标签 angular material-design angular2-template angular-material2 angular2-modal

我使用了 ngx-bootstrap 模式。但是当我在其中使用 mat-select 时,我遇到了问题。 mat-select Options 显示在 Modal 后面。 我已经有了这些解决方案here solutionalso 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-index 冲突。

快速修复

Modify the template css/scss where the modal and mat-select are placed

  .cdk-global-overlay-wrapper, .cdk-overlay-container {
     z-index: 99999 !important;
  }

关于angular - 为什么 mat-select 不能在模态内工作? onclick 它显示模态后面的选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48352238/

相关文章:

node.js - Facebook 看不到 Angular Universal 元标签

javascript - getMonth 抛出错误的月份 (81) - Angular 6

vue.js - 在 Vuetify 中将 Clipped prop 应用于 <v-navigation-bar/> 的正确方法

Angular 2 Uncaught( promise 中): TypeError: Cannot read property 'isActivated' of undefined

angular - Angular 中可重用的自定义组件列表

css - Angular 2 : displaying items in row/column fashion

node.js - Angular 6 PWA 与 Node 不工作

安卓 Material 设计动画

android - 如何在可组合的文本上实现禁用外观

node.js - 在 Angular 2 应用程序中导入 Node js 模块