async presentAlertRadio(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);
}
}
]
});
await alert.present();
}
i want to assign the value of the selected radio in my alert controller to a variable, how can i access it.
new to ionic 4 so don't really know
i want to assign my var x = selectedRadio
text: 'Ok',
handler: (data) => {
console.log('Confirm Ok', data); //handle data here eg.
this.x = data.value1; // this assigns your veritable 'x' to the value
// of Radio 1
}
comment if this needs clarifying
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With