core.js:4117 ERROR TypeError: Cannot read property 'push' of null
udhay-salaria opened this issue · 0 comments
udhay-salaria commented
onCheckChange(event) {
const formArrayItem: FormArray = this.createSubscrition.get('weekDays') as FormArray;
console.log(formArrayItem)
if(event.target.checked){
console.log(event.target.value);
formArrayItem.push(new FormControl(event.target.value))
}
else{
let i: number = 0;
formArrayItem.controls.forEach((ctrl: FormControl) => {
if(ctrl.value == event.target.value) {
formArrayItem.removeAt(i);
return;
}
i++;
});
}
}