I'd like to pass a cell template to a grid column at runtime. The template is just a string that I have elsewhere in memory and can't be declared ahead of time.
I'm looking at the following example at: https://www.telerik.com/kendo-angular-ui/components/grid/columns/templates/#toc-cell-template
<kendo-grid [data]="gridData">
<kendo-grid-column field="ProductName">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
Row: {{ rowIndex }} /
<strong>{{ dataItem.ProductName }}</strong>
<span class="{{ dataItem.Discontinued ? 'discontinued' : 'active' }}">
{{ dataItem.Discontinued ? "discontinued" : "active" }}
</span>
</ng-template>
</kendo-grid-column>
</kendo-grid>
What I want is for the entire ng-template to be defined elsewhere, or at least the contents of it. In the past I was able to do something like:
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
{{ myTemplate }}
</ng-template>
But this hasn't worked for a while. I suspect the custom template needs to be compiled somehow, but am not sure what to do. I looked in to using ngTemplateOutlet, but that also needs the template pre-declared. Any advice is appreciated. Thanks.