Is the modifying of inputs in Alert Controller is possible using the only button inside the prompt itself?
The use case:
- A user is capable to view the password by pressing the “View Password” button in the prompt. So in short the “password” type input will be change into “text”, is this possible?
The Alert Controller
I tried this code but error exist in passing the data from “View Password” to “newPassword”.
async changePassword(){
let alert = await this.alertCtrl.create({
header: 'Change Password',
subHeader: 'Fill up the fields.',
inputs: [
{
name: 'oldPassword',
placeholder: 'Old Password.',
type: 'password'
},
{
name: 'newPassword',
placeholder: 'New Password.',
type: 'password',
value: this.generatePassword(8) //This generate the password
},
{
name: 'newPasswordConfirm',
placeholder: 'Confirm New Password',
type: 'password'
}
],
buttons: [
{
text: 'Cancel',
role: 'cancel',
handler: data => {
console.log('Cancel clicked.');
}
},
{
text: 'View Password',
handler: data => {
data.newPassword.type = 'text'; //Error exists
return false;
}
}
]
});
await alert.present();
}//
The error