将“*”分配给作用域中声明的变量的角度错误
Angular Error assigning “*” to a var declared in scope
我在作用域中声明了var:
$scope.submit = {
next:"",
formparams:"",
value:""
};
在我的 HTML 中,我有:
<div>
<div ng-repeat="opcion in menu.opciones">
<label> Opcion: </label>
<input id="{{opcion.opcion}}" type="radio" name=grupo
value="{{opcion.Submit}}+{{opcion.opcion}}" ng-model="submit.next"
ng-change="submit.value={{opcion.opcion}}" ng-required="true"required> {{opcion.opcion}}
</input>
</div>
</div>
选项数组包含类似 {1,2,3,*}
.
当我选择时,每个数字选项都工作正常,但是当我在浏览器控制台中选择"*"时,出现以下错误:
angular.js:9419 TypeError: a is not a function
at OPERATORS.* (http://192.168.0.3:8080/MobilTest/lib/angular.js:9515:44)
at http://192.168.0.3:8080/MobilTest/lib/angular.js:10041:35
at Scope.$eval (http://192.168.0.3:8080/MobilTest/lib/angular.js:11961:28)
at http://192.168.0.3:8080/MobilTest/lib/angular.js:16943:13
at http://192.168.0.3:8080/MobilTest/lib/angular.js:16784:11
at Array.forEach (native)
at forEach (http://192.168.0.3:8080/MobilTest/lib/angular.js:303:11)
at $setViewValue (http://192.168.0.3:8080/MobilTest/lib/angular.js:16782:7)
at http://192.168.0.3:8080/MobilTest/lib/angular.js:16284:14
at Scope.$eval (http://192.168.0.3:8080/MobilTest/lib/angular.js:11961:28)(anonymous function) @ angular.js:9419(anonymous function) @ angular.js:6843(anonymous function) @ angular.js:16786forEach @ angular.js:303$setViewValue @ angular.js:16782(anonymous function) @ angular.js:16284Scope.$eval @ angular.js:11961Scope.$apply @ angular.js:12061(anonymous function) @ angular.js:16283(anonymous function) @ angular.js:2613forEach @ angular.js:310eventHandler @ angular.js:2612
变量是空的。
In {1,2,3,*}
*
在表达式 {{opcion.Submit}}+{{opcion.opcion}}
中与 +
结合使用时被计算为运算符。只需将其更改为如此{1,2,3,'*'}
的角色,它应该可以工作。
相关文章:
- 使用同一对象中的其他变量声明变量
- 用||声明变量
- 使用javascript使用for循环声明变量
- JavaScript-用for循环项声明变量
- try声明变量的作用域
- 有没有一种方法可以使用函数参数的值来声明变量
- 在使用javascript再次声明变量之前,请先清除或删除该变量
- Javascript未声明变量
- 在Javascript中,我可以在声明变量之前使用它吗
- 在html文档的开头声明变量
- 按什么顺序声明变量和函数
- 如何以正确的方式在jQuery中声明变量
- 在 Angular 服务中接收函数的未声明变量
- 字典和声明变量
- 需要一些有关以以下样式声明变量的信息
- 在 jQuery 中使用常量声明变量
- 从外部文件在打字稿中声明变量得到引用错误:..未定义
- JavaScript,声明变量时混淆语法
- 在 javascript 函数和内存管理中声明变量
- Javascript 使用 if 语句声明变量