I designed an eye icon button for toggling password visibility.
However, I have a specific page that needs to serve as the "password recovery" page.
In this particular page, there are 3 input fields, each with the same toggle button attached to them...
When I click on one button, all three fields become toggled.
How can I individually bind each input field to the same function?
Here is the code snippet:
HTML
<ion-item>
<ion-input placeholder="Old Password" [type]="isPasswordVisible ? 'password' : 'text'">
</ion-input>
<button ion-button icon-only item-right clear color="light" (click)="togglePasswordVisibility()"><ion-icon [name]="isPasswordVisible ? 'eye' : 'eye-off'"></ion-icon>
</button>
</ion-item>
TS
isPasswordVisible: boolean = true;
togglePasswordVisibility(): void {
this.isPasswordVisible = !this.isPasswordVisible;
}
Thank you for your help!