async showAlertRadio(heading:string){
const alert = await this.alertCtrl.create({
header: heading,
inputs :[
{
name : 'Radio 1',
type: 'radio',
label: 'Radio 1',
value: 'value1',
checked: true
},
{
name: 'radio2',
type: 'radio',
label: 'Radio 2',
value: 'value2'
},
],
buttons: [
{
text: 'Cancel',
role: 'cancel',
cssClass: 'secondary',
handler: () => {
console.log('Confirm Cancel');
}
}, {
text: 'Ok',
handler: (data) => {
console.log('Confirm Ok', data);
let x = data;
console.log('Assigned variable x:', x);
}
}
]
});
await alert.present();
}
I am trying to store the selected radio value from the alert controller into a variable. How can I access it?
I'm new to Ionic 4 and not quite sure about the process.
I want to assign my variable x with the selected radio value.