Ionic: Display controller alert by checkbox and text input

I am trying to show a checkbox along with a text input field. (Ionic 3.5.3)

The checkbox is not displayed. I looked at another SO thread for a similar question. The code seems to be the same as what I am doing.

Code:

let alert = this.alert.create({
      title: 'Name your trip',
      inputs: [
      {
        name: 'name',
        placeholder: 'Your trip name',
      },
      {
         name: 'gpsxy',
         type:'checkbox',
         checked:true,
         label:'Log GPS co-ords',
         value:"true"
      }
    ],

      buttons: [{
        text: 'Cancel',
        role: 'cancel',
        handler: data => {
        }
      },
      {
        text: 'Ok',
        handler: data => {
      }],
    });
    alert.present();

      

And here's a screenshot: enter image description here

+3


source to share


1 answer


As you can see in the docs

Alerts can also include several different inputs that can be returned to the application. Logins can be used as an easy way for users to get information. Radios, checkboxes and text inputs are all but cannot be mixed. For example, an alert can have all radio button inputs or all check box inputs, but the same alert cannot mix radio and flag inputs. Note that different types of "text" "inputs" can be mixed, such as URL, email, text, etc. If you require a complex UI form that does not comply with the warning, then we recommend creating the form inside the modal code.



Therefore, I am afraid that this cannot be done in ionic :(

+2


source







All Articles