This package is an Otter Framework Module.
One of the approaches for writing forms that Angular provides is called model-driven or reactive forms, which "provide a model-driven approach to handling form inputs whose values change over time". This type of form is applicable in many use cases, but there are a couple of exceptions where additional utilities may be useful.
These use cases include:
- A container/presenter structure for components
- Handling form submission at page level
- Displaying the error message outside the form
To handle these, this module provides utilities to enhance the build of Angular reactive forms, including:
- An asynchronous decorator (
@AsyncInput
) to ensure subscriptions are handled if the references of the input observables change. - Basic and custom validators to validate user input for accuracy and completeness.
- A dedicated NgRX store for form errors to have the possibility of displaying error messages outside the form component.
- Helper functions to handle the interactions with the forms.
ng add @o3r/forms
[!WARNING] This module requires @o3r/core to be installed.
Find more information in the documentation.