Template driven forms are forms where we write logic, validations, controls etc, in the template part of the code (html code). The template is responsible for setting up the form, the validation, control, group etc.
How do I use template driven forms?
- Build the basic form. …
- Bind form controls to data properties using the ngModel directive and two-way data-binding syntax. …
- Track input validity and control status using ngModel . …
- Respond to a native HTML button-click event by adding to the model data.
Which is better reactive or template driven?
Template Driven Forms are based only on template directives, while Reactive forms are defined programmatically at the level of the component class. Reactive Forms are a better default choice for new applications, as they are more powerful and easier to use.