问题
I am using angular material select in my application which you can find here https://material.angular.io/components/select/overview. The problem is when we place the select near the bottom of the screen it, and when it is opened, It overflow the screen. This is the screenshot of what I am experiencing. What kind of css is needed to prevant this from happening.
<mat-select style="margin-bottom: 0px;" placeholder="{{input1.title}}" >
<mat-option>None</mat-option>
<mat-option *ngFor="let opt_value of input1.enumNameGroups[grp_value] let i = index" value="{{input1.enumidGroups[grp_value][i]}}" >{{opt_value}}</mat-option>
</mat-optgroup>
</mat-select>
回答1:
You can override the default css of the paginator panel to place it anywhere on the screen:
::ng-deep .mat-select-panel {
position: fixed;
bottom: 0;
left: 0;
height: 300px;
width: 100%;
}
Change the properties of the class depending on where you want to place the element.
来源:https://stackoverflow.com/questions/49977202/why-angular-material-select-is-overflowing-the-screen