Questions ({{questionSelec" /> Questions ({{questionSelec" /> Questions ({{questionSelec"/>

How to select all the options in mat-select by default

347 Views Asked by At

I want to select all the options by default in mat-select

Here is my code:

<mat-form-field appearance="outline">
        <mat-label>Questions ({{questionSelected}} of {{structureViewObj.records[0].questions.length}})</mat-label>
        <mat-select multiple  (selectionChange)="selectQue($event.value)" >
          <mat-option *ngFor="let item of structureViewObj.records[0].questions"
            [value]="item.questionId" [selected] = "true">{{item.label}}</mat-option>
        </mat-select>
      </mat-form-field>

here I am using [selected] = "true" but it is not working.

0

There are 0 best solutions below