Ati*_*eon 2 javascript multidimensional-array angularjs-directive angular-material angular
我在使用 Angular Material 的 Angular 6 版本中发现了一个问题。任何人都可以帮助我修复 $event 的这个错误。
ERROR Error: Cannot assign value "$event" to template variable "nameValue". Template variables are read-only.
at _AstToIrVisitor.push../node_modules/@angular/compiler/fesm5/compiler.js._AstToIrVisitor.visitPropertyWrite (compiler.js:8719)
at PropertyWrite.push../node_modules/@angular/compiler/fesm5/compiler.js.PropertyWrite.visit (compiler.js:7589)
at convertActionBinding (compiler.js:8320)
at prepareEventListenerParameters (compiler.js:17473)
at Object.params (compiler.js:18598)
at compiler.js:18369
at Array.map (<anonymous>)
at compiler.js:18369
at compiler.js:17630
at Array.map (<anonymous>)Run Code Online (Sandbox Code Playgroud)
我没有使用任何模板变量。我直接把它放在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/compiler/fesm5/compiler.js._AstToIrVisitor.visitPropertyWrite (compiler.js:8719)
at PropertyWrite.push../node_modules/@angular/compiler/fesm5/compiler.js.PropertyWrite.visit (compiler.js:7589)
at convertActionBinding (compiler.js:8320)
at prepareEventListenerParameters (compiler.js:17473)
at Object.params (compiler.js:18598)
at compiler.js:18369
at Array.map (<anonymous>)
at compiler.js:18369
at compiler.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/compiler/fesm5/compiler.js._AstToIrVisitor.visitPropertyWrite (http://localhost:4200/vendor.js:39190:27)
at PropertyWrite.push../node_modules/@angular/compiler/fesm5/compiler.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>)Run Code Online (Sandbox Code Playgroud)
对此的任何解决方案
小智 6
我在 Angular 9 上遇到了同样的问题。我发现我已经声明了一个变量,就像"let nameValue of values"我[(item)]=nameValue在模板上所做的那样。问题是我分配item给nameValue了双重绑定。删除()解决了我的问题
| 归档时间: |
|
| 查看次数: |
2212 次 |
| 最近记录: |