~/talk

Angular Dependency Injection – Understanding hierarchical injectors

Talkat Voxxed Days Bucharest 2022 · 2022-03-23..03-25· [angular]

Shows a hand-built injector (a map of tokens to singletons) and live code that proves how Angular resolves providers across child injector per lazy module and the module/element trees, with eager modules sharing root singletons while lazy modules get separate instances unless marked providedIn: 'root' is tree-shakeable. Demonstrates useClass, useValue, useExisting and useFactory with HttpClient and URL token and resolution flags like self, skipSelf and optional, and the examples visibly return different random numbers so behavior is verifiable.

AI-written summary · about

  1. 0:00ANGULAR DEPENDENCY INJECTION
  2. 1:05What is a dependency?
  3. 1:22The Problem
  4. 2:27Solution
  5. 4:01Dependency Injection in Angular
  6. 11:21Two injector hierarchies
  7. 14:57Lazy loaded Module in the Routing!
  8. 16:43Eagerly loaded Modules
  9. 17:10Lazy loaded Modules
  10. 23:49Example of hierarchical dependency injection
  11. 25:47Provide Services in the Modules
  12. 30:33Using Providedin in LazyService
  13. 33:07Add LazyService to the Provider's Array of LazyModule
  14. 35:52Services in a Component
  15. 38:33Dependency Providers
  16. 40:34Unique Injection Token
  17. 44:43Wrapping up
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.