NG-REPEAT within NG-REPEAT - ANGULARJS

1

I have a multidimensional array.

To demonstrate it in my view I use a ng-repeat in an ul within another ng-repeat in a li, this way:

<ul ng-repeat="section in sections">
  <li>
      {{section.name}}
  </li>
  <ul>
    <li ng-repeat="tutorial in section.tutorials">
          {{tutorial.name}}
    </li>
  </ul>
</ul>

How can I display these values in a table? Being that it is not possible this way:

  <tr ng-repeat="section in sections">
    <tr ng-repeat="tutorial in section.tutorials"> 
      <td>{{:: tutorial.name }}</td>
    </tr>
  </tr>
    
asked by anonymous 03.11.2017 / 20:17

2 answers

0

I was able to resolve using ng-repeat-start and ng-repeat-end. Following:

<table>
  <tbody>
  <tr ng-repeat="section in sections">
    <td ng-repeat-start="tutorial in section.tutorials">{{:: tutorial.name }}</td>
    <td ng-repeat-end>{{:: tutorial.autor }}</td>
  </tr>
  </tbody>
</table>
    
06.11.2017 / 12:20
0

try this

<tr ng-repeat="tutorial  in tutorials| filterData: 'sections'">
   <td>{{tutorial.name}}</td>
</tr>

Or use tbody

<table>
  <tbody ng-repeat="section in sections">
  <tr ng-repeat="tutorial in section.tutorials">
    <td>{{:: tutorial.name }}</td>
  </tr>
  </tbody>
</table>
    
03.11.2017 / 20:57