Advanced AngularLesson 34Free preview
Angular Advanced DI
This lesson is part of Angular · All levels
Summary
Advanced dependency injection allows you to register providers in a variety of ways: real value, factory, custom tokens, to multi-provider. InjectionToken helps inject non-class-type values such as configuration. This understanding is useful when building large-scale applications and libraries.
Key points
- InjectionToken is used for non-class values such as configuration
- UseValue, useFactory, and useClass select how to create an instance
- Multi: true collects many providers on one token
- Tree-shakable provider with providedIn saves bundle size
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.