【发布时间】:2018-03-02 06:46:03
【问题描述】:
我有这个 JSON
[{
"name":"student 1",<br>
"urn":"i98n-33",<br>
"courses":[{
"name":"computer science",
"points":17,
"outof":20
},{
"name":"mathematics",
"points":38,
"outof":40
}],<br>
"marks":55,<br>
"total":60<br>
},<br>{
"name":"student 2",<br>
"urn":"bb1r-66",<br>
"courses":[{
"name":"mathematics",
"points":29,
"outof":40
}, {
"name":"computer science",
"points":13,
"outof":20
}],<br>
"marks":41,<br>
"total":60
},<br>{
"name":"student 3",<br>
"urn":"7p85-404",<br>
"courses":[{
"name":"mathematics",
"points":20,
"outof":40
},{
"name":"computer science",
"points":12,
"outof":20
}],<br>
"marks":32,<br>
"total":60
}, {
"name":"MY TEST",<br>
"urn":"yrn9-819",<br>
"courses":[{
"name":"computer science",
"points":14,
"outof":20
},{
"name":"mathematics",
"points":12,
"outof":40
}],<br>
"marks":26,<br>
"total":60
}]
正如您所见,课程索引对于不同的学生是不同的,所以当我尝试 ng-repeat 时会混淆
我想以表格格式显示,例如
<table>
<thead>
<tr>
<th>Index</th>
<th>Student names</th>
<th>course 1</th>
<th>course 2</th>
<th>course ..</th>
<th>course n</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>student 1</td>
<td>marks for course 1</td>
<td>marks for course 2</td>
<td>marks for course ..</td>
<td>marks for course n</td>
<td>Total marks</td>
</tr>
</tbody>
</table>
我不知道怎么做,任何帮助将不胜感激
【问题讨论】: