Im trying to make from scratch a table in angular. I want that my header and body be dynamic.
<my-datatable>
<my-header header></my-header>
<my-body body></my-body>
</my-datatable>
and my header component is
<thead >
<tr>
<th style="text-align: left;" *ngFor="let field of fields | async ">
{{ field }}
</th>
</tr>
</thead>
my body component is
<tbody>
<tr *ngFor="let item of items | async ; let rowIndex = index; " >
<td *ngFor="let field of fields | async; let colIndex = index;" >
{{ item[field] }}
</td>
</tr>
</tbody>
my datatble component
<table>
<ng-content select="[header]"></ng-content>
<ng-content select="[body]"></ng-content>
</table>
The table is displayed but is showed like two tables, even when I inspect just show one table.