javascript - How to use ng-repeat by table data? -
given array of 7 elements (7 arrays 1 element each) want display 1 table row (because have 1 element in each array) containing 7 table data. table output should this:
label1 | label2 | label3 | label4 | label5 label6 | label7 0
javascript
$scope.array = [ [ { id: 1, label: 'some label1' } ], [ { id: 2, label: 'some label2' } ], [ { id: 3, label: 'some label3' } ], [ { id: 4, label: 'some label4' } ], [ { id: 5, label: 'some label5' } ], [ { id: 6, label: 'some label6' } ], [ { id: 7, label: 'some label7' } ] ];
html
<table> <tr ng-repeat="item in array"></tr> // generate 7 rows </table>
you can following:
<table> <tr> <td ng-repeat="item in array">{{item[0].label}}</td> </tr> </table>
and here working sample: https://plnkr.co/edit/syo6ypummz3b9eghznks?p=preview
Comments
Post a Comment