angularjs - Render array of arrays table in Angular using ng-repeat -
i have array of arrays (representing rows , columns) , need render html table data.
each row array of column values, example: $scope.table.row[0] = [123, 456, 789]
this attempt (that doesn't work). ideas?
<table> <tbody> <tr ng-repeat="row in table"> <td ng-repeat="col in row">{{col}}</td> </tr> </tbody> </table>
you either need iterate on table.row
or make table
array of arrays itself. demo.
<table> <tbody> <tr ng-repeat="row in table.row"> <td ng-repeat="col in row">{{col}}</td> </tr> </tbody> </table>
or
table = [ [123, 456, 789], [111, 222, 333], [111, 222, 333]] <table> <tbody> <tr ng-repeat="row in table"> <td ng-repeat="col in row">{{col}}</td> </tr> </tbody> </table>
Comments
Post a Comment