angularjs json架构表单UI

时间:2018-02-28 23:48:15

标签: angularjs forms jsonschema

我想在角度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个属性和两个属性

1 个答案:

答案 0 :(得分:0)

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

  

有时,您想要的验证在JSON中表达起来很棘手   Schema或Schema Form(尚未支持),如anyOf和oneOf。

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