angular2-json-schema-form
Version:
Angular 2 JSON Schema Form builder
67 lines (66 loc) • 1.47 kB
JSON
{
"schema": {
"type": "object",
"title": "Comment",
"properties": {
"comments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"email": {
"title": "Email",
"type": "string",
"pattern": "^\\S+@\\S+$",
"description": "Email will be used for evil."
},
"comment": {
"title": "Comment",
"type": "string",
"maxLength": 20,
"validationMessage": "Don't be greedy!"
}
},
"required": [
"name",
"email",
"comment"
]
}
}
}
},
"form": [
{
"type": "help",
"helpvalue": "<h4>Tabbed Array Example</h4><p>Tab arrays can have tabs to the left, top or right.</p>"
},
{
"key": "comments",
"type": "tabarray",
"add": "New",
"remove": "Delete",
"style": {
"remove": "btn-danger"
},
"title": "{{ value.name || 'Tab '+$index }}",
"items": [
"comments[].name",
"comments[].email",
{
"key": "comments[].comment",
"type": "textarea"
}
]
},
{
"type": "submit",
"style": "btn-default",
"title": "OK"
}
]
}