0

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.

Faisal Amdani
  • 109
  • 14
  • in mat select you can select only one value and $event can take only one value. if you want a multi select drop down use this:-https://material.angular.io/components/select/examples#select-custom-trigger – Storytellerr Apr 19 '23 at 10:52
  • I amusing the same mat select see the code – Faisal Amdani Apr 19 '23 at 11:35

0 Answers0