I want to make a TableRowsComponent in angular 2 that displays several rows of a table.
I would like to use it in a template as follows:
<table class>
<tbody>
<table-rows *ngFor="#item of list" [someInput]="item"></table-rows>
</tbody>
</table>
(So, "table-rows" will be the TableRowsComponent selector here). The TableRowsComponent template will look something like this:
<tr>
<td> foo </td>
<td> bar </td>
</tr>
<tr *ngIf="something">
....
</tr>
<tr *ngFor="..">
...
</tr>
If we did this, the result is as follows:
<table class>
<tbody>
<table-rows>
<tr>
...
</tr>
<tr>
...
</tr>
</table-rows>
<table-rows>
<tr>
...
</tr>
<tr>
...
</tr>
</table-rows>
</tbody>
</table>
Unfortunately, table-rows> elements ruined the rendering of the table. How to solve this problem? Maybe a way to make angular2 not display <table-rows> elements?
source
share