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

后端 未结 2 1443
孤街浪徒
孤街浪徒 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: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

提交回复
热议问题