Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49418

Ion-select select default value not working

$
0
0

@joe_c_sleiman wrote:

I have ion-select with that have many options and I have when the view is ready to select one default value depending on CurrentNumber. i have this code:

<ion-select formControlName="Level">
          <ion-option [value]="level.id" *ngFor="let level of levels" [attr.selected]="(level.levelNumber == currentLevel)? true : null">
             {{level.name}}
          </ion-option>
</ion-select>

this.currentLevel = 1;
the data comes from the server like that :

data = [
 {
  levelNumber : 1,
  name:'abcd'
 },
 {
levelNumber:2,
name:'efg'
 }
]

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>