Services - AngularBuildUp/angular-microworkshops-authorization GitHub Wiki
What is a service
Provides anything our application needs. Often shares data or functions between Angular features.
In Angular we use only one class, there are no factories, services etc.
A service is just a class decorated with the Injectable decorator.
One way to make a service globally usable from every component is to register it on AppModule.
Generally the secret is to register on parent component, so child/derived components can use it.
DI is how we provide an instance of a class to another Angular feature. Service is injected into the component's constructor.
The @Injectable decorator provides metadata about the injectables.