Hi,
I am trying to make use of Angular's typed forms, but I am running into some issues regarding the typing. I created this small stackblitz example to demonstrate what I'm trying to achieve. When I define a typed form inside my building.component.ts
, it works completely fine. However, due to the size of the forms I'm using, I'm attempting to build the form in a separate function (in a separate file) to keep my code cleaner. However, whenever I do this, it loses the typing. Does anyone here have any experience with this issue or any knowledge that could help me achieve my goal?
Thanks in advance!
Top comments (1)
Why do you wanna init form in a separate file? I've met this solution and it worked bad.
About your question: you need to remove returned type for
initBuildingForm
function or specify it in full.FormGroup
is a generic.