将角度8 app迁移到9的奇怪问题

问题描述 投票:0回答:1

我正在将应用程序从8号角迁移到9号角。如果我尝试为部署而构建,则会收到此错误消息

错误中的错误:无法将值“ $ event”分配给模板变量“ value”。模板变量是只读的。在_AstToIrVisitor.visitPropertyWrite(... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:8617:31)在PropertyWrite.visit(... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:7459:28)在convertActionBinding(... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:8224:49)在prepareEventListenerParameters(... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:16861:27)在Object.params(... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:17952:24)在... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:17725:94在Array.map()在... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:17725:60在... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:17014:87在Array.map()在TemplateDefinitionBuilder.buildTemplateFunction(... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:17014:60)在... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:17558:60在... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:16992:81在Array.forEach()在TemplateDefinitionBuilder.buildTemplateFunction(... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:16992:37)在Object.compileComponentFromMetadata(... \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:18643:58)

我如何找到问题所在?根本不清楚。

angular
1个回答
0
投票

听起来您似乎在某些地方有一些html

<input #value (click)="value = $event" />

其中输入是某些元素,(单击)是某些事件处理程序。 (我以输入和单击为例,该错误消息并未说明其实际含义)

尝试在代码中使用模板变量(在本例中为#value)的任何地方查看,并尝试通过事件处理程序以某种方式将事件的结果分配给它。

编辑:

这是否意味着您在运行开发环境时没有看到此错误?如果是这样,这是否意味着您的开发环境中没有aot编译?我认为v9现在默认会将aot设置为true。至少在我最近升级时对我有用。

© www.soinside.com 2019 - 2024. All rights reserved.