Create Form Component

The CreateFormComponent is a dynamic Angular component designed for creating new entities. It integrates with the GenericFormBuilderComponent to dynamically generate forms based on a schema and provides features like template customization, submission logic, and navigation.

How to use the component in your app :

  1. import the component :

import {CreateFormComponent} from '@tradinos/cms-frontend-form';
  1. The selector for component , like it :

<lib-create-form></lib-create-form>

Features

  1. Dynamic Form Generation:

    • Uses the GenericFormBuilderComponent to build forms dynamically based on a configuration schema.

  2. Form Submission:

    • Handles data validation and submission through the integrated cmsService.

  3. Custom Templates:

    • Allows developers to inject custom templates for specific parts of the form.

  4. Submit Button Control:

    • The submitButton input controls whether the submit button is displayed or hidden.

  5. Navigation:

    • Integrates with Angular's router for seamless navigation after form submission.

Inputs

Input

Type

Description

Default Value

submitButton

boolean

Controls whether the submit button is displayed in the form.

true

templates

{ [key: string]: TemplateRef<any> }

A dictionary of custom templates to customize specific parts of the form UI.

{}

Methods

1. submit(): void

  • Description:

    • Handles form submission.

    • Retrieves the form data from the GenericFormBuilderComponent, validates and transforms it, then submits it via the service.

    • Navigates to the appropriate route upon successful submission.

Content Projection

Slot Name

Description

Custom Templates

Developers can use templates input to define custom parts of the form.

Last updated