I have a
with the multiple
option set (a multi-select). When the selectionChange
event fires I need to know which o
This worked for me. blahs
is an array of strings in this case. Use 2-way binding:
<mat-select placeholder="choose..." [(value)]="selected"
(selectionChange)="somethingChanged(selected)">
<mat-option *ngFor="let b of blahs; index as i;" value={{b[i]}}">{{b[i]}}
</mat-option>
</mat-select>
I needed to use onSelectionChange
on the <mat-option>
, which is different than the selectionChange
that you can use on the <mat-select>
It would be nice if that was in the documentation for mat-select
.
Here it is working https://stackblitz.com/edit/angular-1e9gsd-34hrwg?file=app/select-overview-example.html