【发布时间】:2018-12-27 10:33:01
【问题描述】:
我有一个包含以下 html 的组件
<table>
<thead>
<tr>
<th>
</tr>
</thead>
<tbody>
<ng-container #container class="sample">
</ng-container>
</tbody>
</table
另一个组件只有一个 tr(table rows) 即
<tr>
<input class="form-control form-control-text-input" type="text" placeholder="Enter ID" [(ngModel)]="id"/>
</tr>
现在我正在使用这个答案动态添加这个表格行组件 Dynamically ADDING and REMOVING Components in Angular
但是当它在浏览器上呈现时,我得到了关注 Click on image
动态组件在 div 中呈现,但我只希望 tr 在 tbody 中。
请帮忙。
更新:我在 stackblitz Stackblitz 上创建了一个假人
【问题讨论】:
-
重新创建此问题的最小堆栈闪电战将为您提供更多帮助
-
感谢 Akber 的建议,我创建了 stackblitz:stackblitz.com/edit/angular-bhewus
标签: angular typescript angular6