3

I need to pass a HTML template to a common control which a data table, as a parameter to that grid.

I am passing the innerHTML uisng the sanitize pipe so it renders properly.

<div *ngIf="col.useCellTemplate"
              [innerHTML]="col.customTemplate | sanitizeHtml">
</div>

The HTML template I am passing -

<button class="btn btn-sm btn-primary"
        (click)="testCellCallback2(data)">Click Me
</button>

The problem is that I can see button and even "(click)="testCellCallback2(data)" " when I check in developer console of the browser but the click event doesn't work.

I think it is Angular 6 behavior to ignore any event when passed through innerHTML property. IS there a way to make this work and bind html in some other way.

0 Answers0