And here's a Playground sample of the issue - make sure the cursor is in the textfield while hitting the show/hide button to see the problem.
I have a simple TextField for user to input a password in my NS+Angular app. I am trying to implement show/hide functionality. Here's what I tried:
<GridLayout rows="auto, auto" class="field" row="0">
<Label text="Password" class="field-label" *ngIf="focused" textWrap="true" row="0"></Label>
<TextField hint="Password" [ngClass]="{'field-text': true, 'inactive': !focused}" [secure]="pwdSecure"
formControlName="password" [(ngModel)]="password"
(ngModelChange)="focused = password.length ? true : false"
(blur)="focused = password.length ? true : false" returnKeyType="next" (returnPress)="focusConfirmPwd()" row="1">
</TextField>
<Label *ngIf="focused" [text]="pwdSecure ? 'show' : 'hide'" (tap)="pwdSecure = !pwdSecure" class="secure pull-right" textWrap="true" row="1"></Label>
</GridLayout>
In the .ts file, I am initializing the relevant variables as follows:
pwdSecure = true;
confirmPwdSecure = true;
When I hit 'hide' all is well, the password mask shows nicely. When I hit 'show' though, the password text shows but there is too much space between the text and the cursor. The cursor remains where it should be when there is a mask.
Any idea what I need to do to fix this?
Thanks!