angular innerhtml style code example
Example 1: angular innerhtml style not working
import { DomSanitizer } from '@angular/platform-browser'
import { PipeTransform, Pipe } from "@angular/core";
@Pipe({ name: 'safeHtml'})
export class SafeHtmlPipe implements PipeTransform {
constructor(private sanitized: DomSanitizer) {}
transform(value) {
return this.sanitized.bypassSecurityTrustHtml(value);
}
}
...
<div [innerHtml]="html | safeHtml"></div>
Example 2: angular innerhtml style
import { ViewEncapsulation } from '@angular/core'
encapsulation: ViewEncapsulation.None