Uncaught Error: Unexpected module 'FormsModule' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation

后端 未结 4 1015
说谎
说谎 2021-01-30 19:26

I\'m new in Angular. I started Tour of Heroes to learn it. So, I am created an app.component with two-way binding.

import { Component          


        
4条回答
  •  轮回少年
    2021-01-30 19:57

    Remove the FormsModule from Declaration:[] and Add the FormsModule in imports:[]

    @NgModule({
      declarations: [
        AppComponent
      ],
      imports: [
        BrowserModule,
        FormsModule
      ],
      providers: [],
      bootstrap: [AppComponent]
    })
    
    

提交回复
热议问题