EP 10.2 - Angular / Dependency Injection & Providers / Injectors

preview_player
Показать описание


We configure injectors with providers.

We pass to injectors a token and then resolve this into a dependancy.

Injectors cache dependancies, so multiple calls result in the same instance being returned.

Different injectors hold different caches, so resolving the same token from a different injector will return a different instance.

We create child injectors from parent injectors.

A child injector will forward a request to their parent if it can’t resolve the token itself.

So far we’ve only covered providers that provide classes providers can provide other types of dependencies which is the topic of the next lecture.
Рекомендации по теме
Комментарии
Автор

Amazing! Finally I start understading how this works!

marcossalvo
Автор

Wow! Thank you for explaining it so clearly. Great work!

Gogolian
Автор

What if i want different instance everytime....how to achieve that

programmingpracticals