Services are not the Angular construct, but rather a pattern. Angular Services are nothing more than a class to encapsulate some logic that you want to share across places in your application. We are using Angular 9 for this example. The Components should not get or store data directly, and they indeed shouldn’t knowingly present fake data.
Their main focus should be representing the data and delegate the data access to a service.
If you are new to Angular, then please check out my these tutorials.
Angular Service is typically a class with a well-defined purpose. It should do specific and do it well. Angular distinguishes components from services.
Services in Angular are a great deal to share information among classes that do not know each other. When we are developing the Angular app, we will most likely run into an outline in which we need to use the exact same code across multiple angular components. In that case, the Services will help us to get rid of that problem.
#angular #angular 9