Ionic version:
[x] 5.x
Current behavior:
When using Ionic Alert controller, "ok button" handler method is called twice. When I add role: "cancel" to the ok button, it is called only once like it should.
Related code:
async showDialog(iterable: Array<any>) {
let inputs: Array<any> = [];
for (const x of iterable) {
inputs.unshift({
name: x.title,
type: "radio",
label: x.title,
value: x,
handler: (value) => {
this.someOtherMethod(value.value);
alert.dismiss();
},
});
}
const alert = await this.alertController.create({
header: "Title",
message: "Message",
inputs: inputs,
buttons: [
{
text: "Cancel",
role: "cancel",
cssClass: "cancel-t-button",
handler: () => {},
},
{
text: "Add",
role: "ok",
cssClass: "add-t-button",
handler: () => this.someMethod(),
},
],
});
await alert.present();
}
Thanks for the issue. Update to Ionic Framework v5.2.2. This issue was fixed in that release.
Thanks for the issue. Update to Ionic Framework v5.2.2. This issue was fixed in that release.
Thanks, it's working now.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Most helpful comment
Thanks for the issue. Update to Ionic Framework v5.2.2. This issue was fixed in that release.