The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Use RxJS Streams with Angular 2 Forms

Use RxJS Streams with Angular 2 Forms

3:05
Angular 2 forms provide RxJS streams for you to work with the data and validity as it flows out of the forms. These streams allow you handle complex scenarios and asynchronous scenarios with relative ease. This example shows you how to log out the values of the form when the form is valid.
Watch this lesson now
Avatar
egghead.io

Angular 2 forms provide RxJS streams for you to work with the data and validity as it flows out of the forms. These streams allow you handle complex scenarios and asynchronous scenarios with relative ease. This example shows you how to log out the values of the form when the form is valid.

Avatar
John

I misspoke on the example. Using the combineLatest operator means valueChanges will fire first giving you an invalid value "combined" with 'VALID' immediately before you get the invalid value with 'INVALID'.

Here's an updated example which filters directly on the statusChanges then uses withLatestFrom to make the example more in line with what I explained in the lesson above:

https://embed.plnkr.co/9aNuw6DG9VM4X8vUtkAa?show=src%2Fapp%2Fapp.components.ts,preview

In reply to egghead.io
Avatar
Morgan

you need to mention that you import ViewChild from angular core

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?