angular - 我为材料表的选择部分写了一个函数
问题描述
我为材料表的选择部分编写了一个函数,但由于某种原因我的函数没有运行
<ng-container matColumnDef="select" sticky>
<th mat-header-cell *matHeaderCellDef class="px-2 w-50px">
<mat-checkbox (change)="$event ? masterToggle() : null" color="warn"
[checked]="selection.hasValue() && isAllSelected()"
[indeterminate]="selection.hasValue() && !isAllSelected()"
[attr.aria-label]="checkboxLabel()">
</mat-checkbox>
</th>
<td mat-cell *matCellDef="let row; let i = index" class="px-2 w-50px">
<mat-checkbox (click)="selectRow($event, i)" color="warn"
(change)="$event ? selection.toggle(row) : null"
[checked]="selection.isSelected(row)"
[attr.aria-label]="checkboxLabel(row)">
</mat-checkbox>
</td>
</ng-container>
selectRow(event: any, index: number) {
console.log('event', index, event);
event.stopPropagation();
}
我只想运行此代码,但单击时没有任何反应。我在其中运行的另一个函数是材料表的选定函数。为什么我的代码在单击时不运行可能是什么问题?
解决方案
推荐阅读
- javascript - 如何在 JQuery 中访问 Angular 6 变量
- c# - mvc PagedList.IPagedList 视图想要打印所有记录
- jenkins - 由于 500 内部服务器错误,测试失败
- javascript - 我想使用 azure 媒体服务进行视频录制和流式传输
- javascript - PDF概述链接在我的angularjs应用程序中不起作用
- android - 指定 armeabi-v7a,但 jni 继续构建 x86_64
- swift - 无法确定这是否算作一次读取/多次读取/我会收取数据库成本的费用吗?
- gis - Geoserver 金字塔 DEM 在某个缩放级别变为 0
- php - 模拟不存在于类中的函数的调用(例如 php 标准函数)以具有固定的行为
- xamarin - 如何在已经存在的 xamarin 应用程序中实现拆分视图?