Fix Can’t bind to ‘formGroup’ since it isn’t a known property of ‘form’ Error

You are getting this error because you haven’t imported the ReactiveFormsModule in your app.module.ts file. Since the formGroup is a part of the ReactiveFormsModule. So to use it, you have to import the ReactiveFormsModule in the corresponding module.ts file.

You can import the ReactiveFormsModule from the forms library of Angular.

See the following example:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    FormsModule,
    ReactiveFormsModule,
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Note: If your Angular application has more than one modules, you have to import the ReactiveFormsModule in each module wherever you are using the formGroup.

OR if you have a common shared module for all of your feature modules, you have to add the ReactiveFormsModule in the import and export both sections so that you can use it in each feature modules.


Author

  • Manoj Kumar

    Hi, My name is Manoj Kumar. I am a full-stack developer with a passion for creating robust and efficient web applications. I have hands-on experience with a diverse set of technologies, including but not limited to HTML, CSS, JavaScript, TypeScript, Angular, Node.js, Express, React, and MongoDB.