0

I am using <mat-select> to populate images in the dropdown like below:

<mat-select formControlName="linePattern" 
class="pattern-dropdown">
  <mat-option *ngFor="let w of lineStyleList"  value="{{w.value}}">
    <img class="image-allignment" src="{{w.img}}" >
  </mat-option>
</mat-select>

lineStyleList is an object of following type :

lineStyleList = [
 {
  name: 'ShortDash',
  value: [14],
  img: this.generateImage('ShortDash')
 },
 {
  name: 'Dash',
  value: [12],
  img: this.generateImage('Dash')
 }
]

The images are getting populated in the dropdown but when I select an options it's not getting set in the drodpown. Also, how do I set default value in the dropdown.

Gregoire Ducharme
  • 1,095
  • 12
  • 24
sabin
  • 841
  • 12
  • 15

0 Answers0