using Angular ng-repeat to display JSON rows/columns

前端 未结 1 1714
天涯浪人
天涯浪人 2021-01-27 12:04

The JSON I am getting back from the API is nested FIRST by field (i.e. table columns), THEN by record(i.e. table rows). So, the JSON looks like this:

myJSON = {
         


        
相关标签:
1条回答
  • 2021-01-27 12:22

    You can just iterate over one of the arrays and use $index to get the corresponding elements in any other arrays:

    <tbody ng-repeat="id in myJSON.data.id">
        <tr>
            <td>{{id}}</td>
            <td>{{myJSON.data.gorks[$index]}}</td>
        </tr>
    </tbody>
    
    0 讨论(0)
提交回复
热议问题