October 2017
Intermediate to advanced
280 pages
6h 50m
English
Since components are generally directives with templates, everything we've seen so far regarding how the DI mechanism works with directives is valid for components as well. However, because of the extra features that the components provide, we're allowed to have further control over their providers.
As we said, the injector associated with each component will be marked as a host injector. There's a parameter decorator called @Host, which allows us to retrieve a given dependency from any injector until it reaches the closest host injector. This means that, using the @Host decorator in a directive, we can declare that we want to retrieve the given dependency from the current injector or any parent ...
Read now
Unlock full access