Hi, I have been trying to figure out a way to add a default value for my . I have an array with a js interface.
<ion-select
interface = 'alert'
class="t-select"
placeholder = "Select your item"
[(ngModel)]="selectedItem">
<ion-select-option *ngFor="let item of itemArr; let i = index" value="{{item.id}}" class="t-option" >
{{ item.token + ' <' + item.id.substring(0, 12) + '>' }}
</ion-select-option>
</ion-select>
- I have tried adding [value]=“selectedItem()” which returns the item I want.
- I tried the compareFn.
- I tried the directory [ngValue] in .
All I want is for my to choose the first item in the itemArr if nothing is passed to it.
And I also am choosing the item from another page, and then adding a slider on it so that I can choose an option and pass it to my other page using params. isn’t defaulting to that id either…
Any help would be appreciated!