Skip to content

Instantly share code, notes, and snippets.

@yoelnacho
Created April 2, 2017 22:32
Show Gist options
  • Save yoelnacho/e6b395e5d22e88d0cf1e8ae182ec2ea0 to your computer and use it in GitHub Desktop.
Save yoelnacho/e6b395e5d22e88d0cf1e8ae182ec2ea0 to your computer and use it in GitHub Desktop.
Angular2 Pipe: DOM seguro
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
@Pipe({
name: 'domseguro'
})
export class DomseguroPipe implements PipeTransform {
constructor( private domSanitizer:DomSanitizer ){ }
transform( value: string, url: string): any {
return this.domSanitizer.bypassSecurityTrustResourceUrl( url + value );
}
}
<iframe [src]=" pista.uri | domseguro:'https://embed.spotify.com/?uri='" width="300" height="80" frameborder="0" allowtransparency="true"></iframe>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment