我在Angular JS中有功能,即重置HTML表单:
nested exception is org.neo4j.ogm.metadata.MappingException: Error mapping GraphModel to instance of com.noxgroup.nitro.domain.Person
Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Set
at com.noxgroup.nitro.domain.converters.RightConverter.toEntityAttribute(RightConverter.java:9) ~[main/:na]
HTML看起来像:
$scope.resetForm = function (formName)
{
$scope.formData = angular.copy(formEdit);
$scope.formName.$setPristine();
}
点击后我收到错误:
<form name="educAddForm" novalidate>
<div ng-click="resetForm(educAddForm)">Click</div>
答案 0 :(得分:0)
+1 PSL的评论。改变
$scope.formName.$setPristine()
到
formName.$setPristine()
请记住,因为formName被传入函数,即使传入了一个范围变量,你也应该将它作为函数范围内的参数名称引用。
答案 1 :(得分:0)
$scope.resetForm = function (formName)
{
$scope.formData = angular.copy(formEdit);
formName.$setPristine();
}