@NgModule
's providers
array. There's a LoginService
registered with the root injector.@Component
. This particular component has no providers
array and will use the root injector for all of its dependencies.ChatWindow
component. Each of these components has their own instantiation of a ChatService
.Logout/Login
, but it has no injector.ChatFeed
and ChatInput
components for each ChatWindow
. There are also LoginWidget
and LogoutWidget
components with Logout/Login
as their parent.providers
array in its decorator. Components that have no providers
array look to their parent component for an injector. If the parent does not have an injector, it looks up until it reaches the root injector.provider
arrays. If a child component is decorated with a providers
array that contains dependencies that were also requested in the parent component(s), the dependencies the child receives will shadow the parent dependencies. This can have all sorts of unintended consequences.Unique
is bootstrapped into the root injector.Unique
service generates a value unique to its instance upon instantiation.Unique
. This component will not share the same value as the root injector's Unique
instance.