Trying to get the closed event of mat autocomplete but getting undefined. I do not know why i am getting undefined. If anyone knows please help to find the solution.
app.component.html:
<mat-autocomplete #auto="matAutocomplete" (closed)="onClosedEvent($event)" >
<mat-option *ngFor="let animal of animals"
[value]="animal.name">
{{animal.name}}
</mat-option>
</mat-autocomplete>
app.component.ts:
onClosedEvent(event) {
console.log(event);
}
Demo: https://stackblitz.com/edit/angular-rgqlgr?file=src%2Fapp%2Fapp.component.ts