我是Angular7和PrimeNG的新手。我不知道如何将表标题作为变量传递:
<p-table [value]="userSrv.items" [title]="table.title">
<ng-template pTemplate="caption" let-title>
{{title}}
</ng-template>
<ng-template pTemplate="header">
<tr>
<th>Name</th>
<th>Email</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-item>
<tr>
<td>{{item.fullName}}</td>
<td>{{item.email}}</td>
</tr>
</ng-template>
</p-table>或如何在ngTemplate='caption'组件方法上插入动态ngOnInit (或其他模板)。
发布于 2018-12-01 11:30:15
没有必要定义像[title]="table.title"或let-title这样的东西。
您可以以这种方式对称地使用标题模板:
<ng-template pTemplate="caption">
{{title}}
</ng-template>见工作StackBlitz
https://stackoverflow.com/questions/53553642
复制相似问题