There's more...

This type of form construction is what is known as template forms in Angular and is a very common way to bind user inputs to component properties. However, there is another way of building forms in Angular called reactive forms.

Reactive forms aren't inherently better or worse than template forms. They are just a different paradigm to approach form data manipulation using reactive programming techniques. Reactive forms may be a good idea for you if you are interested in having tighter control over the data-flow between your component model and your form input's data-binding. Using reactive forms involves creating a low level FormControl that handles changes in value and validity states of an input in a synchronous manner. We will discuss form validation in the next section, but suffice to say that asynchronous changes in the state of inputs can sometimes result in timing issues in your user interface that may be better managed with reactive forms.

To use reactive forms, you will need to import the ReactiveFormsModule from Angular. You can learn about this module and reactive forms through the following Angular official documentation:
https://angular.io/docs/ts/latest/guide/reactive-forms.html
..................Content has been hidden....................

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