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>
/* :host /deep/ mySelector { */
:host ::ng-deep mySelector {
background-color: blue;
}
for CSS added to index.html
/* body /deep/ mySelector { */
body ::ng-deep mySelector {
background-color: green;
}