我正在使用角度6,我想使用ngModel:
<input type="text" [(ngModel)]="textValue">
所以我得到这个错误:
Can't bind to 'ngModel' since it isn't a known property of 'input'
我尝试将表单模块添加到我的login.module.ts但我收到webpack的错误:
Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
我的依赖是:
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0"
我该怎么做才能让mgModel在Angular 6上运行?
请在您的app.module.ts
中包含以下内容:
import { FormsModule } from '@angular/forms';
@NgModule({
imports: [FormsModule]
})
如果你没有包含在@NgModule中,你将得到上述错误