【发布时间】:2019-09-21 19:33:35
【问题描述】:
我想在当前列的值上添加一个条件。我无法读取当前行的值。 我不知道我必须使用什么变量来检查我使用行但未定义的条件
<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>
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);
}
【问题讨论】:
-
漏洞服务服务.getVulnerabilities()从哪里获取漏洞?
-
您好achraf,您是否看到模板的字母ID 错误?
<ng-template #dothid>,这是示例还是真实代码?
标签: html angular typescript angular-material mat-table