Created
August 23, 2019 20:48
-
-
Save zomdar/a487bf4bc7fbc3cb680dced4659b2d2c to your computer and use it in GitHub Desktop.
safeHtml pipe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform } from '@angular/core'; | |
import { DomSanitizer, SafeHtml } from "@angular/platform-browser"; | |
@Pipe({ | |
name: 'safeHtml' | |
}) | |
export class SafeHtmlPipe implements PipeTransform { | |
constructor(private _sanitizer:DomSanitizer) {} | |
transform(html: string): SafeHtml { | |
return this._sanitizer.bypassSecurityTrustHtml(html); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment