小编Ach*_*ouk的帖子

为行值添加条件(角材料)

我想在当前列的值上添加一个条件。我无法读取当前行的值。我不知道我必须使用什么变量来检查我使用的行但未定义的条件

<ng-container matColumnDef="idCve">
    <th mat-header-cell matHeaderCellDef mat-sort-header> IDCVE </th>
    <ng-container ngIf="row.idCve != null; else dothis" >
        <td mat-cell matCellDef="let row"> {{row.idCve}} </td>
    </ng-container>
    <ng-template #dothid>
        <td mat-cell matCellDef="let row"> --------- </td>
    </ng-template>
</ng-container>
Run Code Online (Sandbox Code Playgroud)

TS文件

Constructor(vulnerabilityServiceService: VulnerabilityServiceService) {
    const vulnerabilities = vulnerabilityServiceService.getVulnerabilities();
    // Assign the data to the data source for the table to render
    this.dataSource = new MatTableDataSource(vulnerabilities);
}
Run Code Online (Sandbox Code Playgroud)

html typescript angular-material angular mat-table

3
推荐指数
1
解决办法
6657
查看次数

标签 统计

angular ×1

angular-material ×1

html ×1

mat-table ×1

typescript ×1