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(); 

output

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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -