Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ALEXOTANO/6268b7ef729561eac16f27a309a78a8b to your computer and use it in GitHub Desktop.
Save ALEXOTANO/6268b7ef729561eac16f27a309a78a8b to your computer and use it in GitHub Desktop.
a Input using Angular Material + Fontawsome with the visible not visible functionality clicking on the eye icon at the right
View/Hide Password Input

Remember to change the passH variable to a diffrent one in each input you place in the dom within the same scope. Using the name/id + and H ( as in Hide xD ) is usally a good idea to avoid repeating.

<mat-form-field>
    <input [type]="!passH ? 'password' : 'text'" matInput placeholder="A new Password" [(ngModel)]="pass" name="pass">
    <div matSuffix (click)="passH = !passH"><i class="fas fa-{{!passH ? 'eye-slash' : 'eye'}} "></i></div>
</mat-form-field>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment