projects/app-base-library/src/lib/angular/pipes/trust-as-html.pipe.ts
name | trustAsHtml |
transform | ||||
transform(value: )
|
||||
Parameters :
Returns :
any
|
import {PipeTransform, Pipe} from '@angular/core';
import {DomSanitizer, SafeHtml} from '@angular/platform-browser';
@Pipe({
name: 'trustAsHtml'
})
export class TrustAsHtmlPipe implements PipeTransform {
constructor(private _sanitizer: DomSanitizer) {
}
transform(value) {
if (!value) {
return value;
}
const html: SafeHtml = this._sanitizer.bypassSecurityTrustHtml(value);
return html;
}
}