As we know, one must configure an injector with a provider, or it won't know how to create the dependency. The most obvious way for an injector to create an instance of a service class is with the class itself. If you specify the service class itself as the provider token, the default behavior is for the injector to instantiate that class with new.
0008-16- angular: Injector and Provider Relationship 2/4 video describes
- How Injectors are inherited in angular?
- How angular Dependency Injection is hierarchical in nature?
Each component has its own Injector & provider. If it needs any service first it will go to its own Injector & provider. If required service is not available at that node, it will go to injector of its parent node & corresponding provider. This process goes until it gets the node with provider which will provide the required service.
This is how Injectors are inherited in angular. Below snapshot shows Angular Dependency Injection hierarchy through Log service example.