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 :
import the component :
import {CreateFormComponent} from '@tradinos/cms-frontend-form';The selector for component , like it :
<lib-create-form></lib-create-form>Features
Dynamic Form Generation:
Uses the
GenericFormBuilderComponentto build forms dynamically based on a configuration schema.
Form Submission:
Handles data validation and submission through the integrated
cmsService.
Custom Templates:
Allows developers to inject custom templates for specific parts of the form.
Submit Button Control:
The
submitButtoninput controls whether the submit button is displayed or hidden.
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