0

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>
1
  • 1
    Why not try it like {{item}}.{{list}}? Since these are different objects with properties. Commented Jun 2, 2016 at 3:59

3 Answers 3

1

Access it in the following manner :

<div ng-repeat="item in items">
 <div ng-repeat="list in lists">
      {{item[list]}}
 </div>
</div>
Sign up to request clarification or add additional context in comments.

Comments

0

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>

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.