Looking to customize the template of an ngx-datatable cell, I decided to create a small view in my HTML file. To check if the template is functioning correctly, I included some placeholder text within it:
<ngx-datatable
class="material"
[rows]="rows"
[columns]="columns"
headerHeight="45">
</ngx-datatable>
<ng-template #roleTemplate let-row="row" let-value="value" let-i="index">
<strong> **{{ value }}** </strong>
</ng-template>
Using ViewChild in my component, I obtained the template and assigned it to the datatable.
@ViewChild('roleTemplate') roleTemplate: TemplateRef<any>;
public columns = [
{ name: 'Name', prop: 'displayName' },
{ name: 'Email', prop: 'emailAddress' },
{ name: 'Role', prop: 'role', cellTemplate: this.roleTemplate },
{ name: 'Status', prop: 'status' },
];
Despite following the documentation, which mentions:
cellTemplate: TemplateRef
Angular TemplateRef allowing you to author custom body cell templates
The customized template does not seem to be working as expected. Is there something I might have overlooked?