【发布时间】:2019-05-06 22:02:32
【问题描述】:
我检查了SO post1 和SO post2,但这是由 jquery 和 javascrip 完成的。但我想在 html 本身中执行此操作
我的对象结构是这样的
this.resultDetails = [
new resultDetail(new Date('11/26/2018'), [
new scoreDetail('physics', '20'),
new scoreDetail('chemistry', '15')
]),
new resultDetail(new Date('10/12/2018'), [
new scoreDetail('physics', '25'),
new scoreDetail('chemistry', '20')
]),
new resultDetail(new Date('7/1/2018'), [
new scoreDetail('physics', '30'),
new scoreDetail('Bio', '11')
])
];
我的html
<div>
<table thTable>
<tr>
<th>
Analysis
</th>
<th *ngFor="let r of resultDetails">
{{r.resultDate}}
</th>
</tr>
<ng-container *ngFor="let r of resultDetails">
<tr *ngFor="let s of r.scoreDetails">
<td>{{s.subjectName}}</td>
<td *ngIf="r.resultDate == ??">{{s.marks}}</td>
</tr>
</ng-container>
</table>
</div>
在这里我想检查日期并想在相应的单元格中显示标记。我对 html 并不熟悉,因为我来自 WPF 背景。请建议我替代设计,以按照下图以表格格式显示我的对象。
【问题讨论】: