angularJS - Repeating tr's in a table, but dynamically adding more rows while looping -


since examples tell more words here in language

<tr>     <c:foreach items="${items}" var="item">        <td>...</td>       <td>...</td>       <td>...</td>       <c:if test="${item.showwarning}">          </tr><tr><td colspan="3">${item.warning}</td>       </c:if> </tr> 

so loop on set of items , show properties of these items. if there warning, new row added underneath current row in warning shown. however, how can in angularjs? if put ng-repeat on tr, stop @ first end tag of tr. have read on other threads not done, how can done? , yes, want use table. here contrived example angularjs not working to. pointers how can done?

jsbin example tr-ng-repeat

one solution can think of having multiple tbody tags within same table. here discussion on use of multiple tbody tags within same table.

so, issue, have following setup:

<table ng-controller="itemcontroller">     <thead>         <th>name</th>         <th>description</th>         <th>warning?</th>     </thead>     <tbody ng-repeat="item in items">         <tr>             <td>{{item.name}}</td>             <td>{{item.description}}</td>             <td>{{item.warning}}</td>         </tr>         <tr ng-show="item.warning">             <td colspan="3" style="text-align: center">warning !!!</td>         </tr>     </tbody> </table> 

repeat table body many times there entries table , within have 2 rows - 1 display row entry , 1 displayed conditionally.


Comments