angular 2 error: Can't resolve all parameters for FormGroup

后端 未结 2 1444
孤街浪徒
孤街浪徒 2021-01-13 07:08

I am following Thoughtram\'s tutorial for FormBuilder http://blog.thoughtram.io/angular/2016/06/22/model-driven-forms-in-angular-2.html I copied the code and changed a few

相关标签:
2条回答
  • 2021-01-13 07:30

    One more reason for this error is when you imported formgroup twice. I removed it in my app module, now it works for me, Hope it help someone.

    0 讨论(0)
  • 2021-01-13 07:35

    Did you add the Angular reactive forms module as an import to your module? It looks like it's missing the services that are registered by that module.

    (am on my phone, so sorry for the brief answer)

    Edit

    This is what I mean:

    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@anglar/platform-browser';
    import { ReactiveFormsModule } from '@angular/forms';
    
    @NgModule({
      imports: [BrowserModule, ReactiveFormsModule],
      declarations: [AppComponent],
      bootstrap: [AppComponent]
    })
    export class AppModule {}
    

    Note the import of ReactiveFormsModule

    0 讨论(0)
提交回复
热议问题