Trying to transfer the state of a dynamically generated checkbox to a method triggered by clicking the label.
Here's the HTML code:
<div *ngFor="let label of consent.labels" style="flex-direction: column">
<div [ngClass]="{'accept': consent.aceptado === true, 'optional': !consent.obligatorio }">
<section style="margin-top: 5px;">
<mat-checkbox color="primary" [(ngModel)]="consent.aceptado" (change)="verify()">
<div [innerHTML]="label.label | safeHtml" (click)="detailSubConsent(checkBoxState, $event)"></div>
</mat-checkbox>
</section>
</div>
</div>
Furthermore, using event.preventDefault() prevents the checkbox state from changing when the label is clicked.
Is there a way to capture and pass the current state of the dynamically generated checkbox to the method triggered on click?