angular - 将 Angular 8 应用程序迁移到 9 的奇怪问题
问题描述
我正在将应用程序从 angular 8 迁移到 9。如果我尝试构建部署,我会收到此错误消息
ERROR : Cannot assign value "$event" to template variable "value". Template variables are read-only.
at _AstToIrVisitor.visitPropertyWrite (...\node_modules\@angular\compiler\bundles\compiler.umd.js:8617:31)
at PropertyWrite.visit (...\node_modules\@angular\compiler\bundles\compiler.umd.js:7459:28)
at convertActionBinding (...\node_modules\@angular\compiler\bundles\compiler.umd.js:8224:49)
at prepareEventListenerParameters (...\node_modules\@angular\compiler\bundles\compiler.umd.js:16861:27)
at Object.params (...\node_modules\@angular\compiler\bundles\compiler.umd.js:17952:24)
at ...\node_modules\@angular\compiler\bundles\compiler.umd.js:17725:94
at Array.map (<anonymous>)
at ...\node_modules\@angular\compiler\bundles\compiler.umd.js:17725:60
at ...\node_modules\@angular\compiler\bundles\compiler.umd.js:17014:87
at Array.map (<anonymous>)
at TemplateDefinitionBuilder.buildTemplateFunction (...\node_modules\@angular\compiler\bundles\compiler.umd.js:17014:60)
at ...\node_modules\@angular\compiler\bundles\compiler.umd.js:17558:60
at ...\node_modules\@angular\compiler\bundles\compiler.umd.js:16992:81
at Array.forEach (<anonymous>)
at TemplateDefinitionBuilder.buildTemplateFunction (...\node_modules\@angular\compiler\bundles\compiler.umd.js:16992:37)
at Object.compileComponentFromMetadata (...\node_modules\@angular\compiler\bundles\compiler.umd.js:18643:58)
我怎样才能发现问题发生了?
解决方案
替换代码有点
*ngFor="let movement of allowedMovements" [(value)]="movement"
至
*ngFor="let movement of allowedMovements; let i = index" [(value)]="allowedMovements[i]"
推荐阅读
- class - 导致错误的输入元素
- html - github markdown中的图片列
- shell - 在 POSIX shell 中,如何在每次运行时增加一个变量?
- sap-cloud-platform - 如何处理 MTA 打包的集成测试?
- mongodb - 从String到ObjectId的Spring数据MongoDb聚合查找
- entity-relationship - HAPI FHIR - 数据模型 - 实体关系,有没有人链接到基于 FHIR 的 ERD 模型
- powerbi-desktop - 将 Power BI 报表嵌入到 MVC 应用程序中的问题
- json - 为 RestController 配置 ObjectMapper
- flask - 我是烧瓶的新手,试图运行第一个应用程序..这是我的代码,终端返回的是什么..有什么建议吗?
- matlab - matlab中循环的向量化