Using this example in my code: https://stackblitz.com/edit/angular-rskaug?file=src%2Fapp%2Fapp.component.html
Html in component
<td><input type="checkbox" (change)="onChange(employee.id, $event.target.checked)"></td>
Typescript in component
onChange(id: any, isChecked: boolean) {
const idFormArray = <FormArray>this.myForm.controls.employeeRelatedId;
if (isChecked) {
idFormArray.push(new FormControl(id));
} else {
let index = idFormArray.controls.findIndex(x => x.value == id)
idFormArray.removeAt(index);
}
}
Error Detail
Property 'checked' does not exist on type 'EventTarget'.
45 <input type="checkbox" (change)="onChange(employee.id, $event.target.checked)">