Skip to content

Commit

Permalink
pipes personalizados
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Guzmán committed Feb 21, 2018
1 parent bfb69e0 commit bd6dfb4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/app/pipes/contrasena.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
name: 'contrasena'
})
export class ContrasenaPipe implements PipeTransform {

transform(value: string, activar: boolean = true): string {
if (activar) {
return value.replace(/./g, '*');
}
else return value;
}

}
17 changes: 17 additions & 0 deletions src/app/pipes/domseguro.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Pipe, PipeTransform } from '@angular/core';
//import para asegurarnos que el codigo q se va a poner esté limpio
import { DomSanitizer } from '@angular/platform-browser';
@Pipe({
name: 'domseguro'
})
export class DomseguroPipe implements PipeTransform {

//decalro en constructore para inicializarlo y usarlo
constructor(private domSanitizer: DomSanitizer) { }

transform(value: string, url: string): any {

return this.domSanitizer.bypassSecurityTrustResourceUrl(url + value);
}

}

0 comments on commit bd6dfb4

Please sign in to comment.