Introducing web forms
A form usually has the following characteristics that enhance the user experience of a web application:
- Defines different kinds of input fields
- Sets up different kinds of validations and displays validation errors to the user
- Supports different strategies for handling data if the form is in an error state
The Angular framework provides two approaches to handling forms: template-driven and reactive. Neither approach is considered better; you must choose the one that best suits your scenario. The main difference between the two approaches is how they manage data:
- Template-driven forms: These are easy to set up and add to an Angular application. They operate solely on the component template to create elements and configure validation rules; thus, they are not easy to test. They also depend on the change detection mechanism of the framework.
- Reactive forms: These are more robust when scaling and testing. They operate...