Skip to content

Instantly share code, notes, and snippets.

@techitesh
Created March 25, 2020 12:26
Show Gist options
  • Save techitesh/598213e9fc9b7a19a0a52abeaf25e633 to your computer and use it in GitHub Desktop.
Save techitesh/598213e9fc9b7a19a0a52abeaf25e633 to your computer and use it in GitHub Desktop.
Angular No-Sanitize Pipe
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
@Pipe({ name: 'noSanitize' })
export class NoSanitizePipe implements PipeTransform {
constructor(private domSanitizer: DomSanitizer) {
}
transform(html: string): SafeHtml {
return this.domSanitizer.bypassSecurityTrustHtml(html);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment