I migrated my project to Angular 15 and can no longer directly use the FormsBuilder for Reactive Forms. I get an undefined exception:
ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'group')
TypeError: Cannot read properties of undefined (reading 'group')
This is my code:
settingsForm = this.formBuilder.group({
locations: ''
});
constructor(private formBuilder: FormBuilder) {}
Everything worked fine before. A solution that works is via the lifecycle hook NgOnInit. However, that would be the non-recommended way and I lose my implicit typing.
What can be the reason?