Cannot get selected mat-checkbox on each click

try something like this

in html:

<!-- rows -->
<td mat-cell *matCellDef="let row">
    <mat-checkbox (click)="selectionCh($event)"
              (change)="$event ? selection.toggle(row) : null"
              [checked]="selection.isSelected(row)">
    </mat-checkbox>
 </td>

in ts:

selectionCh($event) {
    $event.stopPropagation();
    let value = $event.target.checked;
    /* iterate over the rows to see which ones are selected 
     * and implement your logic
     */
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top