2

I have following code:

<mat-form-field>
  <mat-select placeholder="Favorite food">
   <mat-option *ngFor="let name of names" [value]="name.value">
     {{ name.value }}
    </mat-option>
    </mat-select>
  </mat-form-field>

My name value may include several contiguous spaces, for example, 3xxx4xxxxName, where x denotes a space. Default behaviors would strip all spaces except one space. The name value will be displayed as 3x4xname. Is there a way style the name? I think I need to use

white-space:pre-wrap

However, I do not know where to put the class to make it work. Any help is welcome. After I added the scss file.

.mat-option {
  white-space:pre;
 }

The combobox stops working.

user3097695
  • 1,152
  • 2
  • 16
  • 42

0 Answers0