gpt4 book ai didi

Angular-6-JSON 架构形式错误 : Nested Arrays getControl error: Unable to find "0" item in FormGroup

转载 作者:行者123 更新时间:2023-12-02 04:20:25 25 4
gpt4 key购买 nike

您好,我目前正在从事一个使用 JSON schema form 的项目

在为具有递归架构引用的嵌套数组使用布局时不断出现以下错误

嵌套数组 getControl 错误:无法在 FormGroup 中找到“0”项。

示例:https://stackblitz.com/edit/angular-c1mzvk

递归引用示例:https://hamidihamza.com/ajsf/?set=ng-jsf&example=ng-jsf-deep-ref&framework=bootstrap-4&language=en

如果我不提供布局或设置 layout = ['*'],该表单将完美运行。如果我确实提供了一个,它就无法呈现表单

Github 不走运 issue要么

最佳答案

这是 stackbiltz 链接: https://stackblitz.com/edit/angular-zvsitp

我已将模式更改为下面提到的代码,并且我在控制台中没有看到任何错误。

schema = {
$schema: "http://json-schema.org/draft-07/schema#",
type: "object",
title: "Product Variant",
additionalProperties: false,
definitions: {
int: {
type: "number",
minimum: 0,
maximum: 10
},
string: {
type: "string",
minLength: 0
},
valueItem: {
type: "object",
properties: { value: { $ref: "#/definitions/int" } }
},
valueItemArray: {
type: "array",
items: { $ref: "#/definitions/valueItemArray" }
},
dtoArray: {
type: "array",
items: { $ref: "#/properties/staffLanguageLevelDto" }
},

},
properties: {
staffLanguageLevelDto: {
type: "object",
properties: {
id: { $ref: "#/definitions/int" },
staffId: {
allOf: [
{ $ref: "#/definitions/int" },
{ maximum: 5, title: "staffId (overriden maximum)" }
]
},
languageId: {
allOf: [
{ $ref: "#/definitions/valueItem" },
{ title: "languageId (object with custom title)" }
]
},
languageLevelId: { $ref: "#/definitions/int" },
languageName2: {
allOf: [
{ $ref: "#/definitions/string" },
{
default: "ole",
maxLength: 3,
title: "languageName2 (custom default & maxLength)"
}
]
},
languageLevelName: { $ref: "#/definitions/dtoArray" }
}
}
}
};

关于Angular-6-JSON 架构形式错误 : Nested Arrays getControl error: Unable to find "0" item in FormGroup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60370101/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com