Reputation: 2325
Given this array of 7 elements (7 arrays with 1 element each) I want to display 1 table row (because I have 1 element in each array) containing 7 table data. So the table output should be something like this:
some label1 | some label2 | some label3 | some label4 | some label5 some label6 | some 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> // this will generate 7 rows
</table>
Upvotes: 0
Views: 39
Reputation: 6676
You can do the following:
<table>
<tr>
<td ng-repeat="item in array">{{item[0].label}}</td>
</tr>
</table>
And here is a working sample: https://plnkr.co/edit/sYo6YPuMmZ3B9EGhznkS?p=preview
Upvotes: 2
Reputation: 1512
I would think if you parse the array items and concatenate them into a string then you should be able to do something like this
<table>
<tr>
<td ng-bind="scope variable name"/>
</tr>
</table>
Upvotes: 0