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

前端 未结 30 1426
予麋鹿
予麋鹿 2020-11-22 12:44

I\'ve got the following error when launching my Angular app, even if the component is not displayed.

I have to comment out the so that my

30条回答
  •  萌比男神i
    2020-11-22 13:11

    import FormsModule in you app module.

    it would let your application running well.

    import { NgModule }      from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import {ContactListCopmponent} from './contacts/contact-list.component';
    import { FormsModule }   from '@angular/forms';
    
    import { AppComponent }  from './app.component';
    
    @NgModule({
      imports: [
        BrowserModule,
        FormsModule
      ],
      declarations: [
        AppComponent,ContactListCopmponent
      ],
      bootstrap: [ AppComponent ]
    })
    export class AppModule { }
    

提交回复
热议问题