Reputation: 954
I have an object like this:
items = [{a:1,b:2},{a:3,b:4}];
lists = [a,b];
Then this is my markup:
<div ng-repeat="item in items">
<div ng-repeat="list in lists">
// I want to display like this
{{ item.{{list}} }}
</div>
</div>
Upvotes: 0
Views: 49
Reputation: 1121
Arrays should be like,
$scope.items = [{a:1,b:2},{a:3,b:4}];
$scope.lists = ["a","b"];
Html should be like,
<div ng-repeat="item in items">
<div ng-repeat="list in lists">
{{item[list]}}
</div>
</div>
Now this will work.
Upvotes: 0
Reputation: 1
the lists array should have quotes around the a and b...
lists = ['a','b'];
then the markup should be...
<div ng-repeat="item in items">
<div ng-repeat="list in lists">
{{item[list]}}
</div>
</div>
Upvotes: 0
Reputation: 5482
Access it in the following manner :
<div ng-repeat="item in items">
<div ng-repeat="list in lists">
{{item[list]}}
</div>
</div>
Upvotes: 1