I encountered an issue while using push() on an array in an Angular 10 project written in Typescript.
Error
Property 'push' does not exist on type '() => void'.ts(2339)
I need assistance in understanding why this error is occurring and how to resolve it.
export class GrantProgramComponent implements OnInit {
grantProgramForms : any = this.fb.array([]);
constructor(private fb: FormBuilder ) { }
ngOnInit(): void {
this.initializeGrantProgramForms();
}
initializeGrantProgramForms(){
this.grantProgramForms.push(this.fb.group({
Id : [0],
ProgramName : [''],
ProgramCode : [''],
StartDate : [''],
EndDate : [''],
Status : [false]
}));
}
}