mardi 28 juillet 2020

Angular Help: drop-down with select all selected by default

It looks like by default the dropdown loads the list but keeps the boxes unchecked. But I want to have the boxes checked by default, since they are actually loaded. Is this possible? I am using Angular Material.

<mat-form-field appearance="fill">
  <mat-label>Toppings</mat-label>
  <mat-select [formControl]="toppings" multiple>
    <mat-option (click)="selectAll(ev)" #ev>
        Select all
    </mat-option>
    <mat-option *ngFor="let topping of toppingList"
        [value]="topping">
            
    </mat-option>
  </mat-select>
</mat-form-field>



Aucun commentaire:

Enregistrer un commentaire