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

2
  • 1
    Possible duplicate of String interpolation inside innerHTML in angular 2 Commented Jan 27, 2019 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 Commented Feb 3, 2019 at 6:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.