Skip to content

Use "<ng-form>" instead of "<form>" to permit nesting, either by default or with an option #123

Closed
@quietlyconfident

Description

@quietlyconfident

(This topic was was touched on in #98)

Briefly:

It would be nice if angular-schema-form ("ASF") constructed forms using <ng-form> instead of <form> so that ASF forms could be nested within other forms.

Background:

We have a form where the user "picks" a person out of an address book, and then enters a title for the person. The "picking" widget results in putting a URI into into the input field, so the model looks something like this:

physician = {
    'uri': '/some/uri/representing/a/person',
    'title': 'Town Dentist' }

On this model we have built a picker widget that gives the user a list of people, and returns the right URI to populate the URI field on the input element. Works great.

The problem is, we would like to be able to permit the user to create the contact with the same widget. Our use case is, you try to pick the person you want, but if they aren't there, you can create a record for them. In our existing widget (not implemented in ASF) we just put a 'new' button on the widget, and when you click it, a sub-form (using ng-form) appears inline. The user can enter the contact details, click "save", and that other model (the person) is validated against its own schema and the URL is again populated into the 'uri'.

This encourages DRY and permits maximum reusability because both the person CRUD form / schema as well as the outer "physician" type record could be implemented in ASF.

For the reasons discussed in #98, this does not seem possible (without changing the default templates) out of the box because ASF creates new forms using the

element which is not nestable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions