I try to use passwordModule in my code, which is working fine then I tried to add toggle mask Upsers
<input id="float-password"
type="password"
[toggleMask]="true"
pPassword />
it gives me the following error
Can't bind to 'toggleMask' since it isn't a known property of 'input'.
I have tried to find the reason and fix, but unfortunately I'm not getting it.
ToggleMask in primeNg password not working
toggleMask wont work with input tag. You need to import import { PasswordModule } from 'primeng/password' in app.module.ts and use like
<p-password formControlName="password" [toggleMask]="true" [feedback]="false"></p-password>
If you want to stick to input format then you can also use this workaround.
<span class="p-input-icon-right">
<i
style="cursor: pointer"
[ngClass]="
currentPassword.type == 'password'
? 'pi pi-eye'
: 'pi pi-eye-slash'
"
(click)="
currentPassword.type =
currentPassword.type == 'password' ? 'text' : 'password'
"
></i>
<input
type="password"
formControlName="currentPassword"
[feedback]="false"
pPassword
#currentPassword
/>
</span>
<p-password formControlName="password" [toggleMask]="true" [feedback]="false"></p-password>
If you want to stick to input format then you can also use this workaround.
<span class="p-input-icon-right">
<i
style="cursor: pointer"
[ngClass]="
currentPassword.type == 'password'
? 'pi pi-eye'
: 'pi pi-eye-slash'
"
(click)="
currentPassword.type =
currentPassword.type == 'password' ? 'text' : 'password'
"
></i>
<input
type="password"
formControlName="currentPassword"
[feedback]="false"
pPassword
#currentPassword
/>
</span>
-
- Information
-
Who is online
Users browsing this forum: No registered users and 9 guests