In my component, I have a button-toggle like this:
<mat-button-toggle-group appearance="legacy">
<mat-button-toggle *ngFor="let session of sessionsArray!">
<fa-icon icon="calendar-alt"></fa-icon>
{{ session.dateSession!.format('dddd D MMMM YYYY') }}
<fa-icon icon="check-circle" class="check" *ngIf="verifyExistingSession(session)"
(click)="onClickSession(session)"></fa-icon>
</mat-button-toggle>
</mat-button-toggle-group>
Everything seems to be in order (sessionsArray contains the necessary objects, icons and dates are displaying correctly, etc.), but when I click on the button nothing happens: the function "onClickSession" is not being triggered.
I've tried putting the function call directly inside the mat-button-toogle element, but it has the same result...
However, if I call the same function outside of the mat-button-toogle-group group, the function works as expected.
Do you have any idea why the click event is not being captured?
EDIT 1
After seeing Eliseo's response, here is the updated code:
TS :
clickOnSession(event: MatButtonToggleChange): void {
// eslint-disable-next-line no-console
console.log(event.value);
}
HTML :
...