Angular表单报错:Can't bind to 'ngModel' since it isn't a known property of 'input'. (")"

错误信息:

core.js:1440 ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'input'. (")">
                                                     id="dataId" name="dataId" [ERROR ->][(ngModel)]="data.dataId">
                    


                        

解决办法:

在模型中加入FormsModule,

例如在system.module.ts中加入FormsModule,

...

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

...

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

export class SystemModule {}

 

你可能感兴趣的:(Angular)