Why (ngModel) is not working?

前端 未结 1 1082
借酒劲吻你
借酒劲吻你 2021-01-19 03:32

I have running the sample application to learn angular 2. In my sample application [(ngModel)] is not working. But when i removes the square brackets (ng

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-19 04:17

    Probably your code is missing this import line in your module:

    import { FormsModule } from '@angular/forms';
    

    You also have to add FormsModule to module imports array:

    @NgModule({
       imports:      [FormsModule, /*...*/ ],
       //...
    })
    

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