Skip to content

Single item in array cause error while removing #301

Open
@kacperdev

Description

@kacperdev

Issue type

I'm submitting a (check one):
[X] Bug report
[ ] Feature request
[ ] Regression (something that used to work, but stopped working in a newer version)
[ ] Support request
[ ] Documentation issue or request

Prerequisites

Before posting, make sure you do the following (check all):
[X] Confirm you are using the latest versions of all necessary packages (or if not, explain why not)
[X] Search GitHub for a similar issue or PR
[X] If submitting a Support request, also search Stack Overflow for similar issues
Note: Please cross-post GitHub support requests to Stack Overflow, and include a link in your GitHub issue to your Stack Overflow question. We do currently respond to support requests on GitHub, but we eventually expect to stop, and will then refer all support questions exclusively to Stack Overflow.

Current behavior

Hi, i'm currently working on some form based on json schema. My json is more complex, but I managed to reproduce that error on your site https://angular2-json-schema-form.firebaseapp.com/.
When Im trying to remove one item from array it gives me an error.
Code:
{ "schema": { "title": "Comment", "type": "object", "required": [ "comments" ], "properties": { "comments": { "type": "array", "minItems": 1, "items": { "type": "object", "properties": { "name": { "title": "Name", "type": "string" } } } } } }, "form": [ { "key": "comments", "items": [ "comments[].name" ] }, { "title": "OK", "type": "submit", "style": "btn-info" } ] }

It's based on one of your examples. The error is: TypeError: "this.getFormControlGroup(...).removeAt is not a function". I'm using Bootstrap 3.

Expected behavior

It should remove one of item from array.

IMPORTANT: How can we reproduce your problem?

{ "schema": { "title": "Comment", "type": "object", "required": [ "comments" ], "properties": { "comments": { "type": "array", "minItems": 1, "items": { "type": "object", "properties": { "name": { "title": "Name", "type": "string" } } } } } }, "form": [ { "key": "comments", "items": [ "comments[].name" ] }, { "title": "OK", "type": "submit", "style": "btn-info" } ] }

Environment

OS name & version: Windows 10
Browser name & version: Firefox 61.0.1
Angular version: 5
Angular JSON Schema Form version(s): 0.7.0-alpha.1
Other relevant software or packages:

Any other relevant information

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