当我单击行上的任意位置时,我的行被选中,即使是我的单选按钮和滑动切换,我希望它仅在用户单击复选框时被选中
selection: SelectionModel<aproveTable> = new SelectionModel<aproveTable>(true, []);
@Output() approveSelectEvent: EventEmitter<aproveTable[]> = new EventEmitter<aproveTable[]>();
ngOnInit() {
this.selection.changed.asObservable().subscribe(
(value: SelectionChange<aproveTable>) => {
this.approveSelectEvent.emit(this.selection.selected);
});
}
<ng-container matColumnDef="select">
<th mat-header-cell *matHeaderCellDef>
</th>
<td mat-cell *matCellDef="let row">
<mat-checkbox (change)="$event ? selection.toggle(row) : null"
[checked]="selection.isSelected(row)">
</mat-checkbox>
</td>
</ng-container>