Angular 10 – cant bind to formGroup since it isnt a known property of form

Angular 10 – cant bind to formGroup since it isnt a known property of form

The problem is you have not declared the LoginComponent in app.module.ts

just declare the LoginComponent in declarations

  declarations: [
    AppComponent,
    LoginComponent==> Add this!
  ]

In your login.component.ts there is no selector for component, It should be like this:

@Component({
  selector: app-login,
  templateUrl: ./login.component.html,
  styleUrls: [./login.component.css]
 })

In addition in app.module.ts, put LoginComponent in the declarations. You put it in imports which is incorrect.

Angular 10 – cant bind to formGroup since it isnt a known property of form

The problem seems to come from LoginComponent.
Can we see your module / component of LoginComponent ?
I suspect you forgot to implement FormsModule and CommonModule in there.

It can also come from the way you made LoginComponent.
Create a login.module.ts, add LoginComponent in declaration and exports.

Leave a Reply

Your email address will not be published.