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
Share Improve this question asked May 29, 2020 at 5:13 AtiRadeonAtiRadeon 211 silver badge2 bronze badges 3- search your template, you must be having a variable declaration like "let nameValue" or "#nameValue" – Aakash Garg Commented May 29, 2020 at 5:51
- 1 Please always include the relevant code snippet(s), because then we can provide exact answers – s.schleu Commented May 29, 2020 at 5:56
-
I think that the problem is that you has a error type code, you're using something
event='what ever'
, must beevent=='what ever'
(two equals) – Eliseo Commented May 29, 2020 at 9:21
1 Answer
Reset to default 9I 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
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744128158a4559710.html
评论列表(0条)