Angular Mat Select Multiple selectionchange finding which option was changed

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


Here is alternative solution. onSelectionChange event is fired before [(ngModel)] is binded. In my case, I needed both binded data and last selected value.

<mat-select multiple [(ngModel)]="selectedValues" name="hebele" #select>
<mat-option #matOption *ngFor="let value of data.Values" (click)="yourMethod(matOption)" [value]="value">
        {{value.Text}}
</mat-option>
</mat-select>

 yourMethod(data: any) {
   let lastSelectedValue = data.value;
   const isChecked = data.selected;
 }