angularjs json架构表单UI

问题描述 投票:1回答:1

我想在角度js中创建下面的形式,它只允许a,b或c,d?有人可以帮忙解决这个问题。 anyOf等不起作用。 Angular正在创建json模式的休息形式,但不适用于下面

    "test": {
      "type": "object",
      "properties": {
        "a": { "type": "string" },
        "b":   { "type": "string" },
        "c": { "type": "string" },
        "d": { "type": "string" }
      },
  "oneOf": [
    { "required": [ "a", "b" ] },
    { "required": [ "c", "d" ] }
  ]
}

上面的Json Schema测试为字段,需要4个属性和两个属性

angularjs forms jsonschema
1个回答
0
投票

假设您使用的是angular-schema-form,则尚不支持布尔逻辑关键字(如oneOf)。

有时,您想要的验证在JSON模式中表达是棘手的,或者Schema Form(尚未)支持它,就像anyOf和oneOf一样。

https://github.com/json-schema-form/angular-schema-form/blob/development/docs/index.md#custom-validation

© www.soinside.com 2019 - 2024. All rights reserved.