Sharing data across different layers of the application can be a common way to manage application state. In Angular, we can share data state through a provider known as a service. Services are often used as singleton classes in Angular, but they can also be scoped to specific modules or components of your application, if necessary. You should be using a service whenever you have a shared state of data in your application that is used by more than one part of your application.
The most common way to use a service is to set up a shared data source at the AppModule level of your application. This will ensure that the service is available downstream to all other components and modules in your application.