【发布时间】:2019-09-05 17:23:30
【问题描述】:
我正在尝试从表行中取消绑定行选择,以便单击行中的任意位置不会勾选复选框。我希望仅在单击框本身时选中该复选框,以便在用户单击其他位置时腾出空间来添加可扩展行(有点像 Gmail 收件箱)。
我只是不知道如何从行中取消勾选复选框。
这里是复选框列的标记
<ng-container matColumnDef="select">
<th mat-header-cell *matHeaderCellDef>
<mat-checkbox (change)="$event ? masterToggle() : null"
(click)="$event.stopPropagation()"
[checked]="selection.hasValue() && isAllSelected()"
[indeterminate]="selection.hasValue() && !isAllSelected()"
[aria-label]="checkboxLabel()">
</mat-checkbox>
</th>
<td mat-cell *matCellDef="let row">
<mat-checkbox (click)="$event.stopPropagation()"
(change)="$event ? selection.toggle(row) : null"
[checked]="selection.isSelected(row)"
[aria-label]="checkboxLabel(row)">
</mat-checkbox>
</td>
</ng-container>
【问题讨论】:
标签: html angular angular-material