you have to implement the method
DomSanitizer
from to@angular/platform-browser
make your custom element a trusted HTML tag.
You can learn more about Angular elements here
import { DomSanitizer } from '@angular/platform-browser';
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-dashboard',
template: `<div [innerHtml]="content"></div>`
})
export class DashboardComponent implements OnInit {
content: any;
constructor(private _domSanitizer: DomSanitizer) {
}
ngOnInit() {
this.content = this._domSanitizer.
bypassSecurityTrustHtml('<h1>This is DonSanitizer</h1>')
}
}