4

EDIT this is a similar (or duplicate) of Angular.js ng-repeat across multiple elements

-

i have a table, whose rows are generated via ng-repeat:

<tr ng-repeat="(key, value) in rows"> 
    <td>{{a}}</td>
    <td>{{b}}</td>
</tr>

i'd really prefer to keep it in <table> tag, and not several inline-blocks, for various reasons.

How can I add another row just below each row, e.g. pseudo-code

[ somehow-repeat ng-repeat="(key, value) in rows"]
    <tr class="1"> 
        <td>{{a}}</td>
        <td>{{b}}</td>
    </tr>

    <tr class="1"> 
        <td colspan="2">
    </tr>
[ /somehow-repeat ]

as far as i know (worth checking) i can't wrap the TR inside another element. just chekced :( the table doesn't show if i the "somehow-repeat" element is or

so - is there a way to add new row despite being in ng-repeat?

Community
  • 1
  • 1
Berry Tsakala
  • 15,313
  • 12
  • 57
  • 80

1 Answers1

7

You can use repeat-start and repeat-end:

<tr class="1" ng-repeat-start="(key, value) in rows"> 
    <td>{{a}}</td>
    <td>{{b}}</td>
</tr>

<tr class="1" ng-repeat-end> 
    <td colspan="2">
</tr>
Ye Liu
  • 8,946
  • 1
  • 38
  • 34