我在控制器中声明了以下架构和表单:
$scope.schema = {
"type": "object",
"properties": {
"s4_0": {
"type": "array",
"title": "CHECKBOXES",
"items": {
"type": "string",
"enum": [
1,
2,
3
]
}
}
}
};
$scope.form = [
{
"key": "s4_0",
"type": "checkboxes",
"titleMap": [
{
"value": "1",
"name": "box 1"
},
{
"value": "2",
"name": "box 3"
},
{
"value": "3",
"name": "box 2"
}
]
},
{
"type": "submit",
"title": "Submit"
}
];
我的观点有以下表单声明:
<form name="myForm"
sf-schema="schema"
sf-form="form"
ng-submit="onSubmit(myForm)"></form>
这会正确呈现复选框,但每次单击复选框时,都会出现以下错误:
angular.js:13424 TypeError: Cannot read property 'length' of undefined
at schema-form.min.js:1
at $watchCollectionAction (angular.js:16734)
at Scope.$digest (angular.js:16869)
at Scope.$apply (angular.js:17133)
at $$debounceViewValueCommit (angular.js:26702)
at $setViewValue (angular.js:26674)
at HTMLInputElement.listener (angular.js:23277)
at HTMLInputElement.dispatch (jquery-1.12.4.min.js:3)
at HTMLInputElement.r.handle (jquery-1.12.4.min.js:3)
当我将我的模式和表单粘贴到 angular-schema-form 游乐场时,这工作正常,但在我的应用程序中它不断抛出错误。此外,当提交时,该字段的值将保存为“false”,而不是选择的选项数组。
知道我做错了什么吗?
我很乐意发布更多可能更有帮助的信息。