2

want use a cell templates for my dynamic data table in angular 7 like ui grid cell template. kindly anybody help me

cell template:

sampleCellTemplate = `<div>city:{{row[field.address.city]}}</div>
<div>zipcode:{{row[field.address.zipcode]}}</div>`

usage:

<span  *ngIf="!field.cellTemplate; else withCellTemplate">
    {{row[field.name]}}
  </span>
  <ng-template #withCellTemplate>
    <span [innerHTML]="field.cellTemplate"></span>
  </ng-template>

my stackblitz demo

thanks in advance

  • 1
    Possible duplicate of [String interpolation inside innerHTML in angular 2](https://stackoverflow.com/questions/42780643/string-interpolation-inside-innerhtml-in-angular-2) – ConnorsFan Jan 27 '19 at 20:25
  • Thanks for the reply, i gone through the suggested older solutions, but in my case, interpolation is not static, if I change to ${row[field.name]}, row and field are undefined. Kindly check my stackblitz demo – Gopala raja naika Feb 03 '19 at 06:15

0 Answers0