Search code examples
ionic-frameworkhtml-selection-select

Can't use ion-select


I use ionic to create an android mobile application. But I have a problem with the select. On the site of ionic, it can be seen that in the documentation, you can use <ion-select>, but strangely, when I try to use it nothing happens. The result is not the one expected, because it has no effect. <ion-select> is not triggering..

So I am forced to use this for now:

<select ng-model="form.city">
      <option value="">Select</option>
      <option ng-repeat="c in city" ng-value="c.id">{{c.name}}</option>
</select>

While I would like to have the same result as on the official website, with <ion-select>


Solution

  • Try this

    <ion-select [(ngModel)]="form.city">
      <ion-option *ngFor="c in city" value="{{c.id}}">
        {{c.name}}
      </ion-option>
    </ion-select>