![](/img/trans.png)
[英]How to pass variable from one component to another component and print that variable in 2nd Component template html file?
[英]How to pass template from 1 component to another
app.module.ts是根模塊。
它具有2個子模塊-1. table.module.ts和2. status.module.ts
表組件是ngx-datatable的包裝器。 我需要將下面的模板從status.component.ts傳遞到table.component.ts:
<ngx-datatable-group-header *ngIf="groupRowsBy" >
<ng-template let-group="group" let-expanded="expanded" ngx-datatable-group-header-template>
<span>
<button (click)="showStatus(group)">{{group.key}}</button>
</span>
</ng-template>
</ngx-datatable-group-header>
我嘗試在table.component.ts中使用<ng-content></ng-content>
並從status.component.ts上方傳遞模板
但這行不通。 有人可以建議如何通過此模板嗎?
提前致謝
如果您嘗試將狀態組件的模板傳遞給平板電腦組件,則可以聲明您的平板電腦組件
您將像這樣聲明您的平板電腦組件html您可以將所有平板電腦模板放在這里,也可以在要插入狀態模板的任何位置放置
平板電腦組件安裝完成后,您可以像這樣將狀態模板傳遞給它
<tablet-component></tablet-component>
在這里,您將狀態模板放入數位板組件標簽中
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.