I've been trying to set the selected option in my ngFor loop for Ionic2, but it doesn't seem to be working as expected. Here's what I've attempted:
<ion-item>
<ion-label>Source</ion-label>
<ion-select [(ngModel)]="filter" >
<ion-option value={{item.val}} *ngFor="let item of options" selected="item.val == 'pencil'">{{item.name}}</ion-option>
</ion-select>
</ion-item>
Unfortunately, the selected option is not displaying as the default choice.
In my TypeScript file:
public options = [
{
"name": "Pencils",
"val" : "pencil"
}
.
.
.
];