Why Reactive Forms?
In this course we’ll learn how to build robust data-entry forms with Angular Reactive Forms. Reactive forms are a really powerful, flexible option in creating forms.
A simpler alternative would be the template-driven form. Now what makes reactive forms different?
- Most work is done in the component, which means it’s easier for us to reuse code.
- The data model is immutable and kept pure.
- We get synchronous access to data and form models, which provides us more predictability.
- Access to low-level APIs gives us more control. Scalability is improved due to access to the low-level APIs and form model.
- It is easier to test reactive forms as we don’t need to interact with change detection or render the UI.
All in all, though reactive forms have a steeper learning curve, if you need more than a very basic form, it can be worth it to choose the explicit, model-driven approach.