Чтобы архивировать это, я предлагаю вам изменить формат объекта json следующим образом.
testJson = [
{
"shortName": "FHSS",
"children": [
{
"physicallyApply": 1,
"onlineApply": 0,
"semesterName": "Summer",
"semesterYear": 2020,
"programName": "B.A. in English",
"studyCampus": "Main Campus",
"programTotal": 1
},
{
"physicallyApply": 0,
"onlineApply": 7,
"semesterName": "Summer",
"semesterYear": 2020,
"programName": "B.A. in English",
"studyCampus": "Permanent Campus",
"programTotal": 7
}
]
},
{
"shortName": "FSIT",
"children": [
{
"physicallyApply": 1,
"onlineApply": 2,
"semesterName": "Summer",
"semesterYear": 2020,
"programName": "B. Sc. in Multimedia and Creative Technology",
"studyCampus": "Main Campus",
"programTotal": 3
}
]
}
];
Затем вы должны изменить свой HTML-код следующим образом.
<table border="1">
<thead>
<tr>
<th>Faculty</th>
<th>Program</th>
<th>Physically Apply</th>
<th>Online Apply</th>
<th>Program Total</th>
<th>Study Campus MC</th>
<th>Study Campus PC</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<ng-container *ngFor="let item of testJson; let i = index">
<tr *ngFor="let child of item.children; let x = index;">
<td >{{x == 0 ? item.shortName : null}}</td>
<td>{{child.programName}}</td>
<td>{{child.physicallyApply}}</td>
<td>{{child.onlineApply}}</td>
<td>{{child.programTotal}}</td>
<td *ngIf="x==0 && i==0" [attr.rowspan]="i">{{totalMC}}</td>
<td *ngIf="x==0 && i==0" [attr.rowspan]="i">{{totalPC}}</td>
<td *ngIf="x==0 && i==0" [attr.rowspan]="i">{{totalMC + totalPC}}</td>
</tr>
</ng-container>
</tbody>
</table>
Проверьтеэто здесь: Stackblitz