Model-driven forms – pros

Reactive forms are very useful in creating, validating and applying custom form validations to our forms in our applications. We can easily trust the model driven approach to do all the heavy duty work that is usually associated with any complex forms. In this section, we will list and understand the pros of using model-driven forms in our applications:

  • Greater flexibility for more complicated validation scenarios and custom, complex form validations
  • The data model is immutable
  • Since the data model is immutable, no data binding is done
  • It's easier to add input elements dynamically (such as subtasks on a task form) using form arrays
  • It's easy to bind various events to input elements using HostListener and HostBindings
  • All the code for the form controls and validations is inside the component, which makes templates much simpler and easier to maintain
  • It's easier to unit test
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.164.75