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

后端 未结 4 1013
说谎
说谎 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:41

    Add FormsModule in Imports Array.
    i.e

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

    Or this can be done without using [(ngModel)] by using

    
    

    instead of

    
    

提交回复
热议问题