Reacting to changes

One of the reasons we chose the Reactive approach was to be able to react to the changes issued by the user. We can do that by subscribing to the valueChanges property exposed by the FormGroup and FormControl classes, which returns a RxJS Observable that emits the latest values.

Truth be told, we've been using Observables since Chapter 3, Frontend with Angular, when we did subscribe to the get() method of HttpClient to handle the HTTP response received by the web server for the first time; we extensively used them again in Chapter 5, Client-Server Interactions, when we had to implement the support for the put() and post() methods as well, and we still use them wherever and whenever we need to fetch the JSON data that feeds our Data Model interfaces and Form Model objects. Now, we'll use them to demonstrate how we can perform custom operations whenever the user changes something within a form.

..................Content has been hidden....................

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