Last active
December 7, 2022 13:10
-
-
Save danywalls/11d3025fe69b2b9e063c37a4916d97ca to your computer and use it in GitHub Desktop.
Angular Pipe for Password.
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'; | |
@Pipe({ | |
name: 'password' | |
}) | |
export class PasswordPipe implements PipeTransform { | |
transform(value: string, hide: boolean = true): any { | |
return !hide ? value.replace(/./g, '*') : value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment