我有一个表,我想在单击“显示更多”时显示到现有表的行。
|-----------------------|
| ID | Name | Address|
|-----------------------|
| 1 | Sally | CA |
|-----------------------|
| 2 | Jim | MA |
|-----------------------|
Show More
点击“显示更多”时显示其他行
|-----------------------|
| ID | Name | Address|
|-----------------------|
| 1 | Sally | CA |
|-----------------------|
| 2 | Jim | MA |
|-----------------------|
| 3 | Tim | TX |
|-----------------------|
| 4 | Sue | MA |
|-----------------------|
我可以像
一样使用吗<table>
<ng-container #container></ng-container>
</table>
<button (click)="showMore()">Show More</button>
@ViewChild('container', {read: ViewContainerRef}) container: ViewContainerRef;
showMore() {
const componentFactory =
this.componentFactoryResolver.resolveComponentFactory(Component);
const component = container.createComponent(componentFactory);
}