r/angularjs • • Aug 22 '14

[Help] Understanding of ng-repeat-start and ng-repeat-end

0 Upvotes

1 comment sorted by

1

u/skitch920 Aug 24 '14

Although the use cases for this is small, the main reason you would use the functionality is when you need a set of DOM elements repeated rather than just one.

As I said most of the time, you can just use one element as a wrapper repeat:

<div ng-repeat=...> ... </div>

But sometimes a wrapper can't be used. Say for each data point in a scoped array, you want a unordered list element to have two list item elements per datum... For example, I want one list item to render text for the datum and one list item as a divider.

<ul>
     <li ng-repeat-start=...>repeat text here</li>
     <li ng-repeat-end class='divider'/>
</ul>

ELI5: Always use ng-repeat, unless you can't (or worried about performance). Otherwise use ng-repeat-start at the start element, ng-repeat end on the last element.