0

I need to repeat 2 divs together, i.e. I would like to do something like this:

<!-- some ng-repeat="item in items" goes here  -->
   <div>{{item.name}}</div>
   <div>{{item.id}}</div>
<!-- end of ng-repeat -->

so that it produces a list of divs like

<div>name1</div>
<div>id1</div>
<div>name2</div>
<div>id2</div>

I cannot wrap my divs into an additional element. Is it possible to achieve this with angularjs?

1

1 Answer 1

2

Use ng-repeat-start and ng-repeat-end:

<div ng-repeat-start="item in items">{{item.name}}</div>
<div ng-repeat-end>{{item.id}}</div>

Note that this requires AngularJS 1.2 or later.

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.