Created
April 2, 2017 22:32
-
-
Save yoelnacho/e6b395e5d22e88d0cf1e8ae182ec2ea0 to your computer and use it in GitHub Desktop.
Angular2 Pipe: DOM seguro
This file contains 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 } 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 ); | |
} | |
} |
This file contains 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
<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