Last Updated: February 25, 2016
· kelion

ng-repeat without parent element

For ng-repeat directive in angular.js we should provide element, that will be repeated. But sometimes we want to have several DOM elements for each item, without any wrapper.

In my case it was two elements for each item: left is static and right to be sortable:

For simple ng-repeat we can do it only with wrapper for each item:

<div ng-repeat="item in items">

Since version 1.2 in angular js we have new directives — ng-repeat-start and ng-repeat-end and now we can replace our code to:

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

Use it!

Say Thanks
Awesome Job

82f9d2b0 ffd5 11e7 9bd5 132a929e586d
Senior QA Engineer
San Francisco Bay Area
Full Time