I have created select, options are loaded from API, the problem is when I have some value that was set before, now I want to display this in this select I don't see this value, marked option is visible after click on select. Why is that? My code.
<form [formGroup]="form">
<ion-item class="transparent">
<ion-select cancelText="Cancel" formControlName="type">
<ion-select-option *ngFor="let type of types" [value]="type">{{type.name}}</ion-select-option>
</ion-select>
</ion-item>
</form>
ngOnInit() {
this.form = this.fb.group({
type: new FormControl('')
})
this.service.getTypes().then((types) => {
this.types= types;
this.form.controls['type'].setValue(this.types[0]);
});
}
export class Type{
public id: number;
public name: string;
}
Please advise, is it possible to display this data.



in your ion-select-option the field value must to have string, not an object or Integer like you are trying, to linked it and parse the Integer value id to string you can make somenthing like: ([value]="'type.id'")