I found an issue in Angular 6 version with that using Angular Material. Anybody can help me to fixed this error of $event.
ERROR Error: Cannot assign value "$event" to template variable "nameValue". Template variables are read-only.
at _AstToIrVisitor.push../node_modules/@angular/piler/fesm5/piler.js._AstToIrVisitor.visitPropertyWrite (piler.js:8719)
at PropertyWrite.push../node_modules/@angular/piler/fesm5/piler.js.PropertyWrite.visit (piler.js:7589)
at convertActionBinding (piler.js:8320)
at prepareEventListenerParameters (piler.js:17473)
at Object.params (piler.js:18598)
at piler.js:18369
at Array.map (<anonymous>)
at piler.js:18369
at piler.js:17630
at Array.map (<anonymous>)
I found an issue in Angular 6 version with that using Angular Material. Anybody can help me to fixed this error of $event.
ERROR Error: Cannot assign value "$event" to template variable "nameValue". Template variables are read-only.
at _AstToIrVisitor.push../node_modules/@angular/piler/fesm5/piler.js._AstToIrVisitor.visitPropertyWrite (piler.js:8719)
at PropertyWrite.push../node_modules/@angular/piler/fesm5/piler.js.PropertyWrite.visit (piler.js:7589)
at convertActionBinding (piler.js:8320)
at prepareEventListenerParameters (piler.js:17473)
at Object.params (piler.js:18598)
at piler.js:18369
at Array.map (<anonymous>)
at piler.js:18369
at piler.js:17630
at Array.map (<anonymous>)
I didn't use any template variable. I put it directly in the Html.
Unhandled Promise rejection: Cannot assign value "$event" to template variable "nameValue". Template variables are read-only. ; Zone: <root> ; Task: Promise.then ; Value: Error: Cannot assign value "$event" to template variable "nameValue". Template variables are read-only.
at _AstToIrVisitor.push../node_modules/@angular/piler/fesm5/piler.js._AstToIrVisitor.visitPropertyWrite (piler.js:8719)
at PropertyWrite.push../node_modules/@angular/piler/fesm5/piler.js.PropertyWrite.visit (piler.js:7589)
at convertActionBinding (piler.js:8320)
at prepareEventListenerParameters (piler.js:17473)
at Object.params (piler.js:18598)
at piler.js:18369
at Array.map (<anonymous>)
at piler.js:18369
at piler.js:17630
at Array.map (<anonymous>) Error: Cannot assign value "$event" to template variable "nameValue". Template variables are read-only.
at _AstToIrVisitor.push../node_modules/@angular/piler/fesm5/piler.js._AstToIrVisitor.visitPropertyWrite (http://localhost:4200/vendor.js:39190:27)
at PropertyWrite.push../node_modules/@angular/piler/fesm5/piler.js.PropertyWrite.visit (http://localhost:4200/vendor.js:38060:24)
at convertActionBinding (http://localhost:4200/vendor.js:38791:45)
at prepareEventListenerParameters (http://localhost:4200/vendor.js:47944:23)
at Object.params (http://localhost:4200/vendor.js:49069:20)
at http://localhost:4200/vendor.js:48840:90
at Array.map (<anonymous>)
at http://localhost:4200/vendor.js:48840:56
at http://localhost:4200/vendor.js:48101:83
at Array.map (<anonymous>)
Any solution for this
event='what ever'
, must be event=='what ever'
(two equals)
– Eliseo
Commented
May 29, 2020 at 9:21
I had the same problem with Angular 9. I figured out that I had declared a variable like "let nameValue of values"
and after I did [(item)]=nameValue
on the Template. The problem was I had assigned item
to nameValue
with double-binding. Removing the ()
solved my problem