Angular 13 表单模块与安装的表单模块相关的错误
注意:
Error: src/app/money_makers/shochat_guts/shochat_content_creator_components/active-stream-dashboard/shochat-contentcreator-chat/shochat-contentcreator-chat.component.html:81:18 - error NG8002: Can't bind to 'ngModel' since it isn't a known property of 'input'.
81 [(ngModel)]="forminput"
但是看看我的应用程序模块,
import {FormsModule} from '@angular/forms';
imports: [
FormsModule,
....
]
此错误仅在我将 Angular 10 项目迁移到 Angular 13 项目时发生。
我通过启动一个新的 Angular 13 项目,然后将 src 文件夹移动到新的 Angular 13 项目,然后安装所有依赖项来完成此迁移,
为什么会发生这种情况?
@NgModule({
declarations: [
...
ShochatContentcreatorChatComponent,
ShochatDisplayToUserComponentComponent,
ShochatUserChatComponent,
UserSetChatnameComponent,
ShochatUserLivevideoComponent,
ShochatUserShochatsDisplayComponent,
ShochatUserVideoCallComponent,
ShochatVideoChatComponent,
ShochatUserVideoCallActualComponent,
ShochattimerComponent,
UserconsomablepreviewComponent,
CreditcardorloginaddneeedComponent,
ContentcreatorendshochatreviewComponent,
UserendshochatreviewComponent,
UserFavLikesPurchaesesComponent,
CreatorstatsComponent,
CreatortypeindexComponent,
ShochatshowpreviewComponent,
EmailverifedrefreshuserloginComponent,
ContentfeedpostsComponent,
ContentcreatorintrovideodashboardComponent,
ShochatEncodingHowtoComponent,
SubscribingplaceholderComponent,
ContentcreatorcategoriesadminComponent,
ModeratecreatorpostsadminComponent,
ContentfeedpostcommentsComponent,
],
imports: [
CommonModule,
BrowserModule,
RouterModule,
FontAwesomeModule,
RecaptchaV3Module,
FormsModule,
ReactiveFormsModule,
HttpClientModule,
AppRoutingModule,
notice:
Error: src/app/money_makers/shochat_guts/shochat_content_creator_components/active-stream-dashboard/shochat-contentcreator-chat/shochat-contentcreator-chat.component.html:81:18 - error NG8002: Can't bind to 'ngModel' since it isn't a known property of 'input'.
81 [(ngModel)]="forminput"
but look at my app module
import {FormsModule} from '@angular/forms';
imports: [
FormsModule,
....
]
this error only happened when I migrated my angular 10 project to a angular 13 project.
I did this migration by starting a new angular 13 project and then moving over the src
folder to the new angular 13 project and then installed all dependencies
why is this happening?
@NgModule({
declarations: [
...
ShochatContentcreatorChatComponent,
ShochatDisplayToUserComponentComponent,
ShochatUserChatComponent,
UserSetChatnameComponent,
ShochatUserLivevideoComponent,
ShochatUserShochatsDisplayComponent,
ShochatUserVideoCallComponent,
ShochatVideoChatComponent,
ShochatUserVideoCallActualComponent,
ShochattimerComponent,
UserconsomablepreviewComponent,
CreditcardorloginaddneeedComponent,
ContentcreatorendshochatreviewComponent,
UserendshochatreviewComponent,
UserFavLikesPurchaesesComponent,
CreatorstatsComponent,
CreatortypeindexComponent,
ShochatshowpreviewComponent,
EmailverifedrefreshuserloginComponent,
ContentfeedpostsComponent,
ContentcreatorintrovideodashboardComponent,
ShochatEncodingHowtoComponent,
SubscribingplaceholderComponent,
ContentcreatorcategoriesadminComponent,
ModeratecreatorpostsadminComponent,
ContentfeedpostcommentsComponent,
],
imports: [
CommonModule,
BrowserModule,
RouterModule,
FontAwesomeModule,
RecaptchaV3Module,
FormsModule,
ReactiveFormsModule,
HttpClientModule,
AppRoutingModule,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您还在功能模块中导入
FormsModule
,该模块包含您正在使用 ngModel 的组件。Make sure you also import the
FormsModule
in the feature module which holds the component where you are using the ngModel.