error NG8002: Can't bind to 'formGroup' since it isn't a known property of 'form'

rohalo

I have component LoginComponent in UsersModule

  @NgModule({
  declarations: [
    UsersComponent,
    LoginComponent
  ],
  imports: [
    ReactiveFormsModule
  ],
  providers: [
  ]
})
export class UsersModule { }

why i cant bind to 'formGroup' ? I imported the necessary module (ReactiveFormsModule)

Maybe it's because i use LoginComponent in here? (AppRoutingModule)

const routes: Routes = [
  {
    path: '',
    component: MainComponent,
  },
  {
    path: 'users',
    component: UsersComponent,
  },
  {
    path: 'login',
    component: LoginComponent,
  },
  {
    path: '**',
    redirectTo: '',
  },
]

@NgModule({
  imports: [
    RouterModule.forRoot(routes),
    FormsModule,
    ReactiveFormsModule],
  exports: [RouterModule],
})
export class AppRoutingModule {}

Help pls. in template

<div class="login-container">
    <form [formGroup]="loginForm" (ngSubmit)="onSubmit()">
    <label for="username"> Name
      <input type="text" id="username"  formControlName="username">
    </label>
    <label for="password"> Pass
      <input type="password" id="password"  formControlName="password">
    </label>
    <button class="btn blue">Enter</button>
    </form>
  </div>
mzkrgkmay

Did you import UsersModule to AppModule?

@NgModule({
  declarations: [AppComponent],
  imports: [
   ... some modules
   UsersModule,
    ],
  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {} 

You cant build app if you do not import modules to AppModule

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

error NG8002: Can't bind to 'formGroup' since it isn't a known property of 'form'. In Angular 9

NG8002: Can't bind to 'formGroup' since it isn't a known property of 'form'

Angular 7 compilation error NG8002 can't bind object since it isn't a known property

error NG8002: Can't bind to 'matDatepicker' since it isn't a known property of 'input'

error NG8002: Can't bind to 'dep' since it isn't a known property of 'app-add-edit-dep'

Can't bind to 'formGroup' since it isn't a known property of 'form'

Can't bind to 'FormGroup' since it isn't a known property of 'form' ----

Can't bind to 'FormGroup' since it isn't a known property of 'form'. ("

Can't bind to 'formGroup' since it isn't a known property of 'form'. error in ionic v5.2.2

Angular error message: Can't bind to 'formGroup' since it isn't a known property of 'form'

Angular unit test error - Can't bind to 'formGroup' since it isn't a known property of 'form'

Form builder angular Can't bind to 'formGroup' since it isn't a known property of 'form'

Angular 9 - Can't bind to 'formGroup' since it isn't a known property of 'form'

Can't bind to 'formGroup' since it isn't a known property of 'form' whilst using SharedModule

Angular 6: Can't bind to 'formGroup' since it isn't a known property of 'form'?

Angular2 : Can't bind to 'formGroup' since it isn't a known property of 'form'

Angular 7 testing: "Can't bind to formGroup since it isn't a known property of form"

Angular 10 - can't bind to 'formGroup' since it isn't a known property of 'form'

Angular 16 Standalone component, "Can't bind to 'formGroup' since it isn't a known property of 'form'"

Can't bind to 'formGroup' since it isn't a known property of 'form'. ReactiveFormsModule already imported

Template parse errors: Can't bind to 'formGroup' since it isn't a known property of 'form'

Angular 4 Can't bind to 'formGroup' since it isn't a known property of 'form'

Can't bind to 'formGroup' since it isn't a known property of 'form' in Angular

Can't bind to 'formGroup' since it isn't a known property of 'form' in Angular 8

Angular Ivy: Can't bind to 'formGroup' since it isn't a known property of 'form'. However ReactiveFormsModule and FormsModule is imported

Can't bind to 'formGroup' since it isn't a known property of 'form' in ionic

Can't bind to 'formGroup' since it isn't a known property of 'form' for second component

Angular 16 - can't bind to 'formGroup' since it isn't a known property of 'form'

Error: Can't bind to 'ngModel' since it isn't a known property of