# Set default selected option of ion-select dynamically

**URL:** <https://forum.ionicframework.com/t/set-default-selected-option-of-ion-select-dynamically/53394>\
**Category:** ionic-v3\
**Created:** [May 30, 2016, 2:06pm UTC](https://forum.ionicframework.com/t/set-default-selected-option-of-ion-select-dynamically/53394 "2016-05-30T14:06:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![cinmaran](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/cinmaran/32/101700_2.png) [@cinmaran](https://forum.ionicframework.com/u/cinmaran)\
**Post date:** [May 30, 2016, 2:06pm UTC](https://forum.ionicframework.com/t/set-default-selected-option-of-ion-select-dynamically/53394/1 "2016-05-30T14:06:40Z")

</div>

Hello Ionites!

I am new to Ionic.

How can I set the default checked option of ion-select dynamically?

Thanks!

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [May 30, 2016, 7:33pm UTC](https://forum.ionicframework.com/t/set-default-selected-option-of-ion-select-dynamically/53394/2 "2016-05-30T19:33:23Z")

</div>

If you’re using two-way binding with `ngModel`, seeding that should work:

```auto
@Page()
export class FruitStand {
  fruit:string = "banana";
}

```

```auto
<ion-select [(ngModel)]="fruit">
  <ion-option value="apple">apple</ion-option>
  <ion-option value="banana">banana</ion-option>
  <ion-option value="cherimoya">cherimoya</ion-option>
</ion-select>

```

If you set `fruit` in the controller code, does that count as “dynamically” for your purposes?

---

<div class="post-metadata">

**Author:** ![Stienin](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/stienin/32/103733_2.png) [@Stienin](https://forum.ionicframework.com/u/Stienin)\
**Post date:** [October 19, 2016, 1:02pm UTC](https://forum.ionicframework.com/t/set-default-selected-option-of-ion-select-dynamically/53394/3 "2016-10-19T13:02:26Z")

</div>

But if I use the object as the value, it does not work. How can I set the initial value?

---

<div class="post-metadata">

**Author:** ![intelinc](https://avatars.discourse-cdn.com/v4/letter/i/b5a626/32.png) [@intelinc](https://forum.ionicframework.com/u/intelinc)\
**Post date:** [October 21, 2016, 8:19pm UTC](https://forum.ionicframework.com/t/set-default-selected-option-of-ion-select-dynamically/53394/4 "2016-10-21T20:19:20Z")

</div>

To preselect an option, you just need to have the ngModel variable == the ion-option value. The select component will automatically take care of the rest. So for the below, if model == ‘my choice’ and category == ‘my choice’ (I set model in ngOnInit() ) then that option will be preselected.

```
<ion-select [(ngModel)]="model" interface="alert" (ionChange)="enableNextButton()">
<ion-option [value]="category" *ngFor=" let category of industry.categories; let idx = index ">{{category}}</ion-option>
</ion-select>
```

---

<div class="post-metadata">

**Author:** ![Dachu](https://avatars.discourse-cdn.com/v4/letter/d/f07891/32.png) [@Dachu](https://forum.ionicframework.com/u/Dachu)\
**Post date:** [March 20, 2017, 3:09pm UTC](https://forum.ionicframework.com/t/set-default-selected-option-of-ion-select-dynamically/53394/5 "2017-03-20T15:09:30Z")

</div>

Hi Stienin

Any luck with this

Also struggling with this

---

<div class="post-metadata">

**Author:** ![chethankumar\_gowda](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@chethankumar\_gowda](https://forum.ionicframework.com/u/chethankumar_gowda)\
**Post date:** [May 9, 2017, 12:27pm UTC](https://forum.ionicframework.com/t/set-default-selected-option-of-ion-select-dynamically/53394/6 "2017-05-09T12:27:51Z")

</div>

@intelinc

How to Pass selected value and Value Index in function enableNextButton()

Thanks…

---

<div class="post-metadata">

**Author:** ![mdevalk](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mdevalk/32/107743_2.png) [@mdevalk](https://forum.ionicframework.com/u/mdevalk)\
**Post date:** [June 13, 2017, 9:55am UTC](https://forum.ionicframework.com/t/set-default-selected-option-of-ion-select-dynamically/53394/7 "2017-06-13T09:55:44Z")

</div>

Same issue here… is there a final answer on this?

---

<div class="post-metadata">

**Author:** ![akshukla07](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/akshukla07/32/109580_2.png) [@akshukla07](https://forum.ionicframework.com/u/akshukla07)\
**Post date:** [June 13, 2017, 11:45am UTC](https://forum.ionicframework.com/t/set-default-selected-option-of-ion-select-dynamically/53394/8 "2017-06-13T11:45:19Z")

</div>

Hi @chethankumar_gowda, @mdevalk  
The selected value will already be accessible via `this.model` variable (or whichever variable you are using in the ngModel). When you have the selected value, you can always use javascript’s indexOf function to get the index:  
`this.industry.categories.indexOf(this.model)`

Hope this helps…

---

<div class="post-metadata">

**Author:** ![BhargavSKumar](https://avatars.discourse-cdn.com/v4/letter/b/6a8cbe/32.png) [@BhargavSKumar](https://forum.ionicframework.com/u/BhargavSKumar)\
**Post date:** [May 19, 2018, 1:18pm UTC](https://forum.ionicframework.com/t/set-default-selected-option-of-ion-select-dynamically/53394/10 "2018-05-19T13:18:14Z")

</div>

please tell me how to preselect multiple ion-options
