ryzskzkhie ryzskzkhie - 6 months ago 10
AngularJS Question

AngularJs : Referencing to the value of an object inside angular {{ }} html markup

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>

Answer

Access it in the following manner :

<div ng-repeat="item in items">
 <div ng-repeat="list in lists">
      {{item[list]}}
 </div>
</div>