mat-select long option value

本小妞迷上赌 提交于 2020-01-24 19:21:26

问题


How can i handle long value in mat-select?

Can i add horizontal scroll?
or can i make the long option value to be 2 line?

i have tried add virtual-scroll class what i got from here, but i got error

<mat-select formControlName="fieldOfWork" placeholder="Pilih bidang pekerjaan"  class="virtual-scroll" required>
   <mat-option [value]="null">Pilih bidang pekerjaan</mat-option>
   <mat-option *ngFor="let fieldOfWork of fieldOfWorks" [value]="fieldOfWork?.value">
      {{fieldOfWork?.label}}
   </mat-option>
</mat-select>

How to Handle the following ?


回答1:


Add the following to your style.css file

.mat-option-text {
  overflow: auto;
  text-overflow: unset;
}

Stackblitz Demo showing horizontal Scroll bar inside option



来源:https://stackoverflow.com/questions/55233278/mat-select-long-option-value

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