How to render a primeng component inside a template but, the content coming from a variable?
constructor(
private sanitized: DomSanitizer
) {}
ngOnInit() {
this.pButton = this.sanitized.bypassSecurityTrustHtml(
'<p-button label="I am a button!" pTooltip="text"></p-button>'
);
}
Inside Template:
<div [innerHTML]="pButton"></div> <!--rendering nothing-->
I tried this approach but not works.
Does anyone know why this happens?
Using Angular and PrimeNg 13
Thanks in advance!