I am facing an issue with retrieving the ID of the checked item upon submission. While I can successfully fetch the selected ID on change, I am unable to do so on submit. It is worth noting that the data I am receiving does not include a "checked" value. Therefore, there may be a method to insert a selected value into the data structure, but I am unsure how to accomplish this.
HTML
<form [formGroup]="itemForm" (ngSubmit)="submit(itemForm)">
<ion-list >
<div>
<ion-item>
<ion-checkbox formControlName="selectAll" (click)="checkAll()" [(ngModel)]="selectedAll" ></ion-checkbox>
</ion-item>
<ion-item *ngFor="let item of items">
<ion-label>
{{item.text}}
</ion-label>
<ion-checkbox [checked]="selectedAll" formControlName="recvd" value="item.id" (ionChange)="select(item)"></ion-checkbox>
</ion-item>
</div>
<button ion-button full type="submit"></button>
</ion-list>
</form>
TS
export class MessagesPage {
selectedAll: boolean = false;
items: [];
constructor(){}
submit(form){
console.log(form.value, 'FORMVALUE HERE') // this returns true
}
select(item){
console.log(item) //this returns the selected item on change with the id
}
}