Skip to content

Instantly share code, notes, and snippets.

@molcik
Last active September 25, 2017 14:08
Show Gist options
  • Save molcik/72d6738190c4171ed90c9842fb4d4969 to your computer and use it in GitHub Desktop.
Save molcik/72d6738190c4171ed90c9842fb4d4969 to your computer and use it in GitHub Desktop.
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
@Pipe({
name: 'safe'
})
export class SafePipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) { }
transform(url) {
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment