My requirement is just this. As per code below, mainarray contain json array with each object having id and name. On click of multiple checkboxes and submit, i just need to log the selected ids. I am unable to figure out exactly , so please favour. What i tried is like below:
In html:
<form [formGroup]="profileDetails" (ngSubmit)="onsubmit(profileDetails.value)">
<div class="cov1" formArrayName="coverageIDs" *ngFor="let member of mainarray;let i=index>
<input type="checkbox" name"member" [formControlName]="i" [value]="member.id">{{member.name}}
</div>
</form>
In ts:
profileDetails=new FormGroup({
coverageIDs:new FormArray([new FormControl('')])
})
I surfed enough and i wasn't convinced with any . Even the above gives only one result true even when multiple checkboxes are selected due to model. Please correct me on these.