Using combineLatest to subscribe to multiple streams together
In the previous recipe, we had to merge all the streams, which resulted in a single output being last emitted by any of the streams. In this recipe, we'll work with combineLatest, which results in having an array as an output, combining all the streams. This approach is appropriate for when you want the latest output from all the streams, combined in a single subscribe.
Getting ready
The project that we are going to work with resides in chapter05/start_here/using-combinelatest-operator, inside the cloned repository.
- Open the project in VS Code.
- Open the Terminal and run
npm installto install the dependencies of the project. - Once done, run
ng serve -o.This should open the app in a new browser tab, and you should see something like this:
Figure 5.11 – The using-combinelatest-operator app running on http://localhost:4200
Now that we have the app running locally...