我想使用從ng-repeat獲得的變量來訪問作用域內的一個對象。Angular ng-repeat變量訪問另一個作用域對象
我的模板是:
<tr>
<td style="font-weight: bold">term</td>
<td ng-repeat="block in blocks">{{ data.block.term }}</td>
<td>{{ total.term }}</td>
</tr>
我的範圍變量是:
$scope.blocks = ['A', 'B', 'C'];
$scope.data = {'A': {'term': 0, 'term2': 7}, 'B': {'term': 2, 'term2': 3}, 'C': {'term': 5, 'term2': 14}};