Angular - Material - Password control

Angular – Material – Password control

Sample

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<form [formGroup]="signin">
<mat-form-field>
<input
matInput
placeholder="Password"
[type]="hide ? 'password' : 'text'"
formControlName="password"
required>
<mat-icon
matSuffix
(click)="hide = !hide"
>{{hide ? 'visibility_off' : 'visibility'}}
</mat-icon>
<mat-hint
*ngIf="!passwordInput.value">
Enter your password
</mat-hint>
</mat-form-field>
</form>

References