I have similar problem as in this question: AngularJS repeat with table and rowspan.
I want to build table with rowspan from object.
But I use array of objects instead of single object as data for table.
Example:
[
{
"key": "key 1",
"values": [
{
"value": "value-1"
},
{
"value": "value-2",
}
]
},
{
"key": "key 2",
"values": [
{
"value": "value-3"
}
]
}
instead of
{
key1:[1,2],
key2:[3,4,5]
}
As a result I want to transform this array:
[
{
"login": "Affiliate 1",
"referrals": [
{
"login": "referral-1",
"bonusAmount": 100.00
},
{
"login": "referral-2",
}
]
},
{
"login": "Affiliate 2",
"referrals": [
{
"login": "referral-3",
"bonusAmount": 300.00
}
]
},
{
"login": "Affiliate 3",
"referrals": [
{}
]
}
]
to table:
<table border="1">
<tr>
<th scope="col">Affiliate name</th>
<th scope="col">Referral name</th>
<th scope="col">Affiliate bonus</th>
</tr>
<tr>
<td rowspan="2">Affiliate 1</td>
<td>referral-1</td>
<td>$100.00</td>
</tr>
<tr>
<td>referral-2</td>
<td></td>
</tr>
<tr>
<td>Affiliate 2</td>
<td>referral-3</td>
<td>$300.00</td>
</tr>
<tr>
<td>Affiliate 3</td>
<td></td>
<td></td>
</tr>
</table>