I have a multiple mat-select
and would like to know if the mat-option
that's been clicked has been selected or deselected. The $event.target
object passed when the (click)
is fired has no selected
attribute I could use.
<mat-form-field>
<mat-select [formControl]="control" multiple>
<mat-option
*ngFor="let option of options"
[value]="option"
(click)="foo($event)"
>
{{ option }}
</mat-option>
</mat-select>
</mat-form-field>
public foo(event) {
const hasBeenChecked = ???? // How do I know if my clicked option has been checked or unchecked?
}
Thanks in advance