I want to add below content dynamically in HTML.
<ng-template #elseblock *ngIf="var">
<h1>
{{heading}}
</h1>
</ng-template>
I am using below approch for this.
In app.component.ts file :
htmldata: any = `<ng-template #elseComponent *ngIf="var">
<h1>
{{ heading }}
</h1>
`;
and in app.component.html
<div [innerHTML]="htmldata"> </div>
but this approch only render h1 tag in the DOM.(no ng-template)
Please help me to add ng-template dynamically so that #else block, *ngIf will also work.