Update Form Component
The UpdateFormComponent is part of the Form Package, designed to handle entity updates dynamically. It leverages the GenericFormBuilderComponent to generate forms dynamically based on a provided schema and provides seamless integration with navigation, submission logic, and templates for customization.
How to use the component in your app :
import the component :
import {UpdateFormComponent} from '@tradinos/cms-frontend-form';The selector for component , like it :
<lib-update-form ></lib-update-form >Features
Dynamic Form Generation:
Uses the
GenericFormBuilderComponentto generate forms dynamically based on a schema.Supports pre-filled form fields with data from the
resultinput.
Custom Templates:
Allows developers to customize specific parts of the form using templates.
Form Submission:
Handles submission logic, including transformations, validations, and API interactions.
Calls a service to update data and navigates upon success.
Built-In Navigation:
Automatically integrates with Angular's router for navigation post-submission.
Submit Button Control:
Provides the option to show or hide the submit button using the
submitButtoninput.
Loading State:
Supports a
[loading]template slot to indicate form processing.
Inputs
Input
Type
Description
dataKey
string
The key used to uniquely identify the data being updated.
templates
{ [key: string]: TemplateRef<any> }
A dictionary of custom templates to customize specific parts of the form.
result
Result<T>
The initial data to pre-fill the form fields.
submitButton
boolean
Controls whether the submit button is displayed.
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
[loading]
Custom loading template displayed when the form is in a loading state (e.g., during submission).
Last updated