When working with mat-select, you can subscribe to an event "selectionChange".
<mat-select
[(ngModel)]="value"
name="someName"
multiple="true"
(selectionChange)="handleEvent($event)"
>
<mat-option
*ngFor="let val of values"
[value]="val"
>
{{ val }}
</mat-option>
</mat-select>
handleEvent(event: MatSelectChange) {
console.log(event.value); // => array of values
}
This will emit a MatSelectChange where you access the current value of the select.
The problem is, when working with multiple selection, the value property will contains an array with all the currently selected values.
What I need, is to know what was the last value the user selected. I have print out the MatSelectChange event to see if there is anything I could use (like, previous values, so I can compare), but, sadly, I don't see anything.
Is it possible to achieve that ?