Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to populate select in Ionic Creator

I am using Ionic Creator for developing an application. While trying to add select (dropdown) I could not see any way to enter options for the dropdown?

like image 652
Umer Khalid Avatar asked Aug 19 '15 06:08

Umer Khalid


People also ask

How do you get selected value from ION select?

We can access the Ionic select by using a standard <ion-select> element. A select component always used with child <ion-select-option> element. If the <ion-select-option> does not have a value attribute, then its text will be used as the value.

How do you use Select in ionic?

Selects are form controls to select an option, or options, from a set of options, similar to a native <select> element. When a user taps the select, a dialog appears with all of the options in a large, easy to select list. A select should be used with child <ion-select-option> elements.


1 Answers

Simple, but not liked, answer: you can't do it by drag&drop.

If you take a look at the source you get when you download from Ionic Creator, you will see it creates "just" the select element:

<select></select>

So, you could "kind of fake it", by drag&dropping the HTML element inside the form element and putting the following code inside:

<label class="item item-select" name="myselect">
    <span class="input-label">Input</span>
    <select>

        <option value="1">1</option>
        <option value="2">2</option>
    </select>
</label>

I don't know if in future guys from Ionic will add this. It would be probably worth it if you request it as a feature over at their (very active) forum: http://forum.ionicframework.com/

like image 130
Nikola Avatar answered Oct 06 '22 09:10

Nikola