我不知道如何处理这个错误:
Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'NgModel' since it isn't a known property of 'ion-input'.
1. If 'ion-input' is an Angular component and it has 'NgModel' input, then verify that it is part of this module.
2. If 'ion-input' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
<ion-item>
<ion-label>Cambio</ion-label>
<ion-input type="text" [ERROR ->][(NgModel)]="item.cambio" placeholder="e.g:"></ion-input>
</ion-item>
Run Code Online (Sandbox Code Playgroud)
关于进口,我也有这个代码:
imports: [
...,
IonicModule.forRoot(MyApp),
...
Run Code Online (Sandbox Code Playgroud)
我正在Udemy 上学习这门课程,但没有关于此问题的任何信息
Awa*_*sir 17
如果您正在使用[(ngModel)]并且仍然收到此错误,请不要忘记FormsModule在当前模块中导入
您正在使用:
[(NgModel)]="item.cambio"
Run Code Online (Sandbox Code Playgroud)
什么时候应该使用:
[(ngModel)]="item.cambio"
Run Code Online (Sandbox Code Playgroud)
像这样更改模板代码:
<ion-item>
<ion-label>Cambio</ion-label>
<ion-input type="text" [(ngModel)]="item.cambio" placeholder="e.g:"></ion-input>
</ion-item>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6682 次 |
| 最近记录: |