Why angular material select is overflowing the screen

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 23:05:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!