I am getting this error when I use push() on the array in an Angular 10 project in Typescript.
Error
Property 'push' does not exist on type '() => void'.ts(2339)
Please help me figure out why this error is coming and how can I resolve it?
export class GrantProgramComponent implements OnInit {
grantProgramForms : any = this.fb.array([]);
constructor(private fb: FormBuilder ) { }
ngOnInit(): void {
this.AddGrantProgramForms();
}
AddGrantProgramForms(){
this.AddGrantProgramForms.push(this.fb.group({
Id : [0],
ProgramName : [''],
ProgramCode : [''],
StartDate : [''],
EndDate : [''],
Status : [false]
}));
}
}