Managing the State of the Application
Explore techniques to manage state in an Angular e-commerce app using Subject and Observable patterns. Learn to control a loader display during data fetching and handle cart operations by sharing data between components and services.
We'll cover the following...
We saw how to communicate between components that have a nested or routing-based relationship. We performed the concept of Subject/observables to send the data throughout the application.
The problem that we faced was that our huge data tasks time to load. So we want to show the user a loader until the data is retrieved.
Let’s see how to do that, we will use the same idea that we followed before. We want to create a subject and observable that maintain the value of a Boolean variable that decides whether the loader should show or not.
A visual idea of what we are trying to do is: ...