Skip to content
Permalink
Browse files
fix password field visibility bug
  • Loading branch information
kelvinikome committed Sep 26, 2018
1 parent cf4242a commit a167822a9ad2b19521fce609c6c1d9718d5d38be
Showing 2 changed files with 10 additions and 2 deletions.
@@ -70,11 +70,11 @@
</div>
<div class="app-input1">
<mat-form-field class="app-input2">
<input matInput placeholder="Password" type="password" formControlName="password" autocomplete="new-password" [type]="!hide ? 'password' : 'text'">
<input matInput placeholder="Password" type="password" formControlName="password" autocomplete="new-password" [type]="passwordField ? 'password' : 'text'">
<mat-error *ngIf="form.get('password').hasError('required')">
Required
</mat-error>
<mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility_off' : 'visibility' }}</mat-icon>
<mat-icon matSuffix (click)="togglePasswordField()">{{passwordField ? 'visibility' : 'visibility_off'}}</mat-icon>
</mat-form-field>
</div>
<br>
@@ -45,6 +45,7 @@ export class LoginComponent implements OnInit, OnDestroy {
];

form: FormGroup;
passwordField: boolean = true;

error$: Observable<string>;

@@ -99,6 +100,13 @@ export class LoginComponent implements OnInit, OnDestroy {
}
});
}

togglePasswordField() {
if (this.passwordField)
this.passwordField = false
else
this.passwordField = true
}

selectLanguage(selectChange: MatSelectChange): void {
sessionStorage.setItem(TRANSLATE_STORAGE_KEY, selectChange.value);

0 comments on commit a167822

Please sign in to comment.