Reputation: 21
<ion-select (ionChange)="onCountryChange($event)" [value]="country" formControlName ="country" name="country">
<ion-select-option [value]="country.name" *ngFor="let country of countryList">
{{country.name}}
</ion-select-option>
</ion-select>
I need to set the default value from one the value obtained from local storage when the page loads
Upvotes: 1
Views: 85
Reputation: 11
For HTML
<ion-select (ionChange)="onCountryChange($event)" [value]="selectedType" formControlName ="country" name="country">
<ion-select-option [value]="country.name" *ngFor="let country of countryList">
{{country.name}}
</ion-select-option>
</ion-select>
For TypeScript
this.selectedType = countryList.find(c => c.value == 'condition');
Upvotes: 1