I want to display the data of this array:
array = [
{nom: nom1, composants: [composant11, composant12]},
{nom: nom2, composants: [composant21, composant22]}
]
I want to display it this way in a table:
composant nom
composant11 nom1
composant12 nom1
composant21 nom2
composant22 nom2
This is my code:
<table>
<tr>
<th>Composant</th>
<th>Nom</th>
</tr>
<template *ngFor="let item of array">
<template *ngFor="let composant of item.composants">
<tr>
<td>{{composant.nom}}</td>
<td>{{composant.code}}</td>
</tr>
</template>
</template>
</table>
My browser is not showing anything. I wonder if really there is a way to do that in the template. Or if I should first transform the array in the component before displaying it. Any suggestion will be appreciated!