I'm currently following the Angular tutorial on their main website, and I'm having difficulty with one of their concepts. It feels loose in the way it refers to what is the Service and what is the Provider, I can't tell if its one or the other. The link takes you right to the problem part of the tutorial.
https://angular.io/tutorial/toh-pt4#injectable-services
So far as I can tell, a Service is used to serve data to Components. Components gain access to Services by having the Services Injected into them. However, the Injector is something that exists in its own right, and the Service needs to be made avilable to it, before it can inject it.
However, the guide that I'm reading feels loose in the way it refers to what is the Service and what is the Provider. At first I thought the entire Hero.Service.ts was the Service. Then it says that @Injectable marks the class as the Service. Okay fine, and yeah that's how Components work, the Decorator specifies what it is. But then the guide says,
"The HeroService class is going to provide an injectable service"
Wait, so HeroService isn't the service, it provides the service object? Remember the words "is going to provide an injectable service", as it comes up later.
The guide goes into a little detail about how the Service retrieves data for Components, and then comes to how Services need to be introduced to the dependency injector via Providers.
Here's the trouble. It says that the Provider creates or delivers the Service, in this case instantiating HeroService. Then it says that HeroService is going to be the Provider of HeroService. To repeat, here are two lines in which they refer to the HeroService as a Service
Implicitly: "You must make the HeroService available to the dependency injection system before Angular can inject it into the HeroesComponent"
Again implicitly "You do this by registering a provider. A provider is something that can create or deliver a service; in this case, it instantiates the HeroService class to provide the service."
Before the tutorial header Create HeroService " They should focus on presenting data and delegate data access to a service...In this tutorial, you'll create a HeroService that all application classes can use to get heroes." Note: heroes is the data
However, then they say that HeroService is registered as the Provider? "Now, you need to make sure that the HeroService is registered as the provider of this service" If HeroService is the Provider, what is "this service" referring to?
Now remember the line "HeroService class is going to provide an injectable service"
So I have two lines of a tutorial referring to HeroService as a Service, and another two lines saying that it's a Provider. Unless, in the latter case, they were using the word "provide" or "service" in a way that was strictly colloquial and wasn't actually referring to to Providers and Services.