ng-zorro报错:Can't bind to 'ngModel' since

it2022-05-05  126

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

这个错误是因为angular6通过>ng new ***创建的项目,默认不会在app.module.ts中引入FormsModule模块,这里需要手动引入一下:

在app.module.ts文件中添加:

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

在@NgModule里面添加FormsModule的imports:

imports: [

  FormsModule

],

即可解决。

原文:https://blog.csdn.net/luanxiyuan/article/details/81304548 


最新回复(0)