我有一个这样的对象:
items = [{a:1,b:2},{a:3,b:4}];
lists = [a,b];
然后这是我的标记:
<div ng-repeat="item in items">
<div ng-repeat="list in lists">
// I want to display like this
{{ item.{{list}} }}
</div>
</div>
答案 0 :(得分:1)
以下列方式访问它:
<div ng-repeat="item in items">
<div ng-repeat="list in lists">
{{item[list]}}
</div>
</div>
答案 1 :(得分:0)
lists数组应该在a和b ...
周围有引号lists = ['a','b'];
那么标记应该是......
<div ng-repeat="item in items">
<div ng-repeat="list in lists">
{{item[list]}}
</div>
</div>
答案 2 :(得分:0)
阵列应该像,
$scope.items = [{a:1,b:2},{a:3,b:4}];
$scope.lists = ["a","b"];
Html应该是,
<div ng-repeat="item in items">
<div ng-repeat="list in lists">
{{item[list]}}
</div>
</div>
现在这将有效。