Skip to content

Tabarray does not work. #1

@jma

Description

@jma

The json schema form tabarray example can not be reproduced.

To reproduce:

  1. clone the repository
  2. npm i
  3. ng serve
    On app-component.html:
      <json-schema-form
        [schema]="exampleSchema"
        [form]="form"
        (onSubmit)="exampleOnSubmitFn($event)">
      </json-schema-form>

on app-component.ts:

  exampleSchema = {
    "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"
  } ];

Any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions