ionic2 - ionic 2 Prompts alert -
how insert radio button , text input inside prompts alert in ionic 2. it's work text input or radio button. want add radio button group radio buttons select 1 option , text input in 1 alert prompt.
my coding
let prompt = this.alertctrl.create({ title: 'add course', message: "enter course detailes", inputs: [ { name: 'id', placeholder: 'course id' }, { name: 'img', placeholder: 'image url' }, { name: 'title', placeholder: 'title' }, { name: 'details', placeholder: 'details' }, { type:'radio', label:'something1', value:'something1' }, { type:'radio', label:'something2', value:'something2' } ], buttons : [ { text: "cancel", handler: data => { console.log("cancel clicked"); } }, { text: "save", handler: data => { console.log("search clicked"); } } ] }); prompt.present();
according documentation:
radios, checkboxes , text inputs accepted, cannot mixed. example, alert have radio button inputs, or checkbox inputs, same alert cannot mix radio , checkbox inputs.
you should use separate component modal controller
@component(...) class addcourses { courseform:formgroup constructor(params: navparams) { } //create form reactive or template driven }
in parent page,
let coursesmodal = this.modalctrl.create(addcourses, data); coursesmodal.present();
Comments
Post a Comment