0

I have a structure like this:

Items is an array of objects and itemName is different for each repetition also in an array. The following structure works with the Items array but how can I change the itemName to be different for each repetition?

<div ng-repeat="Item in Items">
    <div>{{itemName}}</div>
    <ul ng-repeat="it in Item">
        <li>
            {{it.title}}
        </li>
    </ul>
</div>

the data object is like follows:

Items = [ [{ title="title11"},{ title="title12"},{ title="title13"},{ title="title14"}], [{ title="title21"},{ title="title22"},{ title="title23"},{ title="title24"}] ];

itemname is a simple array with just names:

itemName = ["name1", "name2"];

the name has the header for each component and titles are displayed in li

4
  • 2
    What do you want to do? Repeat li with keeping ng-repeat with ul? Commented Jun 7, 2015 at 18:16
  • 2
    what is the structure of your Items (array of objects) and where you have defined itemName??? Commented Jun 7, 2015 at 18:28
  • @nikhil.agw I want to repeat both div and ul but the corresponding name is what changes with every repeat Commented Jun 7, 2015 at 19:58
  • @shreya added the structure in question Commented Jun 7, 2015 at 20:05

1 Answer 1

1

Update your code

<div>{{itemName}}</div>

with

<div>{{itemName[$index]}}</div>
Sign up to request clarification or add additional context in comments.

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.