Igor Simic
4 years ago

Angular - Cant bind to formGroup since it isnt a known property of form

If you are getting error in Angular: Can't bind to 'formGroup' since it isn't a known property of 'form', here is the very simple solution to this problem. Form group is part of angular reactive forms module. And in order to use formGroup you have to import  ReactiveFormsModule. How? Here is how.

This error usually appears when you forget to include ReactiveFormsModule in your main module, or if you are using lazy loading modules you have to include this in your lazy module as well. 
Here is our error:

LoginRegisterModule is serving LoginComponent and this one can not find formGroup

In my case i am using lazy loaded module LoginRegisterModule,  and in this module i have to import ReactiveFormsModule but i have to export it as well. So here is a fix for this error. In the module which is mentioned in error (LoginRegisterModule) add ReactiveFormsModule to imports and exports array

And the error is gone!
Happy coding, mate!