Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

strange problem migrating angular 8 app to 9

Tags:

I'm migrating an application from angular 8 to 9. If I try to build for deploy I obtain this error message

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) 

How can I find the problem happens?

like image 354
Luca Morelli Avatar asked Feb 08 '20 15:02

Luca Morelli


1 Answers

Replace the code kinda

*ngFor="let movement of allowedMovements" [(value)]="movement"  

to

*ngFor="let movement of allowedMovements; let i = index" [(value)]="allowedMovements[i]" 
like image 149
Andrei Varchanka Avatar answered Sep 20 '22 19:09

Andrei Varchanka