【发布时间】:2015-02-19 03:17:13
【问题描述】:
我在尝试使用 ng-repeat 格式化使用两个数组创建的表时遇到问题。我有两个数组; game.Teams[0].Scores 和 game.Teams[1].Scores,以及以下 html:
<table>
<tr>
<th>
Team 0 Scores
</th>
<th>
Team 1 Scores
</th>
</tr>
<tr ng-repeat="score in game.Teams[0].Scores">
<td>
{{score.ExtraPoints}}
</td>
<td>
????
</td>
</tr>
</table>
我想遍历两个列表并用第二个列表中的项目填充第二列。这是否可以通过 ng-repeat 实现,还是我必须将两者合并并在组合列表中循环?
【问题讨论】:
-
当您从服务器检索数据时,您能否设置一个包含两支球队得分的不同数组? (或更改服务器发送的内容)?所以你会有一个像game.Scores[0].team[0]、game.Scores[0].team[1]和game.Scores[1].team[0]、game.Scores[1]这样的数组].team[1], ...
标签: angularjs