Ionic: Showing an alert controller with a checkbox and text input

后端 未结 2 1052
醉梦人生
醉梦人生 2020-12-18 03:06

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

The checkbox is not showing up. I looked at another SO thread for a similar question. The

相关标签:
2条回答
  • 2020-12-18 04:03

    Just like you can see in the docs

    Alerts can also include several different inputs whose data can be passed back to the app. Inputs can be used as a simple way to prompt users for information. Radios, checkboxes and text inputs are all accepted, but they cannot be mixed. For example, an alert could have all radio button inputs, or all checkbox inputs, but the same alert cannot mix radio and checkbox inputs. Do note however, different types of "text"" inputs can be mixed, such as url, email, text, etc. If you require a complex form UI which doesn't fit within the guidelines of an alert then we recommend building the form within a modal instead.

    So I'm afraid that it's not possible to do that in Ionic :(

    0 讨论(0)
  • 2020-12-18 04:07

    Definitely the right thing to do is to create a modal. But I use a workaround, by nesting alerts. I explained and have a working demo in my answer here

    0 讨论(0)
提交回复
热议问题