I have an Angular 5 app that must use Angular Material's mat-select
inside a Bootstrap modal. The issue is that the dropdown options appear behind the modal. My code looks like this:
<mat-form-field class="mdb-form-field form-adjustments">
<mat-select placeholder="What fruit are you looking for?" [formControl]="fruitType" [(ngModel)]="defaultFruitType">
<mat-option *ngFor="let fruitType of fruitTypes" [value]="fruitType">{{ fruitType }}
</mat-option>
</mat-select>
</mat-form-field>
I know I should be using the z-index
to bring Angular Material's selection options to the front. But the question is on what class? I tried applying it to multiple classes from Angular Material, but to no avail. All of the following have failed:
body div.cdk-overlay-container {
z-index: 99999;
}
/deep/ .cdk-overlay-pane {
z-index: 99999 !important;
}
/deep/ .cdk-global-overlay-wrapper, .cdk-overlay-container {
z-index: 99999 !important;
}
.mat-select-menu-container {
z-index: 99999 !important;
}
.mat-dialog-container {
z-index: 99999;
}
/deep/ .mat-select-panel {
z-index: 99999 !important;
}
/deep/ .mat-primary {
z-index: 99999 !important;
}
Does anyone know on which class of Angular Material I must apply the z-index
to bring the select options to the fore of the modal?
Thanks!