1 回答
TA贡献1817条经验 获得超6个赞
似乎你只需要嵌套你的ngIf:
<ng-container matColumnDef="gsc Fields">
<th mat-header-cell *matHeaderCellDef> gsc Fields </th>
<td mat-cell *matCellDef="let row">
<ng-container *ngIf="row.gsc?.field; else fieldArray">
{{row.gsc.field}}
</ng-container>
<ng-template #fieldArray>
<div class="sub-cell" *ngFor="let field of row.gscs"> <!-- need the appropriate css -->
{{field.field}} {{field.value}}
</div>
</ng-template>
</td>
</ng-container>
在你的价值栏中你想要更多类似的:
<ng-container matColumnDef="gsc">
<th mat-header-cell *matHeaderCellDef> gsc value </th>
<td mat-cell *matCellDef="let row"> {{row.gsc?.value || row.gscvalue}} </td>
</ng-container>
不确定这是 100% 但应该很接近
- 1 回答
- 0 关注
- 118 浏览
添加回答
举报