Reputation: 65870
.html
<ion-select formControlName="type">
<ion-select-option value="t?.id" *ngFor="let t of (issueTypes$ | async)?.result;"> {{t?.name}}
</ion-select-option>
</ion-select>
.ts
init() {
this.form = this.formBuilder.group({
type: ['', Validators.required],
});
}
save() {
const maintenance: Maintenance = {
type: this.form.value.type,
};
}
Debug
Why type
shows t?.id
as value?
Upvotes: 0
Views: 21
Reputation: 1794
you need to bind the value. like so
<ion-select-option [value]="t?.id" *ngFor="let t of (issueTypes$ | async)?.result;"> {{t?.name}}
also: i think you need to fetch your form data as:
this.<FORM>.get('<FIELD>').value
Several other items need to be set correctly in order for this to work. please post full form code if you need more assistance
Upvotes: 1