I'm new in Angular7 and PrimeNG. I don't figured out how to pass table caption as variable:
<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>
or how to insert dynamic ngTemplate='caption'
(or other template) on ngOnInit component method.
There's no need to define something like [title]="table.title"
or let-title
.
You can symply use caption templating this way :
<ng-template pTemplate="caption">
{{title}}
</ng-template>
See working StackBlitz