Mastering Angular’s Dependency Injection
summary
A small library builds a configurable navigation sidebar using a typed InjectionToken default state (string[] with home and booking) and shows apps overriding it via provideNavigationState override in the app config and lazy modules adding links. Standalone components use the inject() API and the talk demos provider node hierarchy up to environment injectors. Per-instance variations use a nav-items directive that injects the local token and overwrites it from an input effect so the component shows different menus and it works.
AI-written summary · about
chapters (7)
- 0:00Introduction to DI
- 1:47Configurable sidebar setup
- 3:13Injection tokens for state
- 6:00Local providers in components
- 8:28Multiple components with directives
- 9:53Directive implementation
- 10:36Closing and summary
related talks
57mAngular Dependency Injection, In Depth
01h 00mAngular Dependency Injection In-Depth
46mAngular Dependency Injection – Understanding hierarchical injectors
17mDissecting Dependency Injection: Angular and NestJS
29mDI Deep Dive
30mClimbing up injector trees
38mDependency Injection for Future Generations
39mDeep DI-ving: how Angular's DI system defeated a monolith
