Skip to content

core.js:4117 ERROR TypeError: Cannot read property 'push' of null #2338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
udhay-salaria opened this issue Mar 9, 2021 · 0 comments
Open

Comments

@udhay-salaria
Copy link

udhay-salaria commented Mar 9, 2021

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++;
});
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant