Angular Service Injection with the Dependency Injector (DI)
Course on egghead by Juri Strumpflohner
- 36 min
- LengthVideo runtime
- Subscription
- Price modelegghead plan
- 12
- Lessons
- 5.0
- Rating out of 51 ratings on egghead
- Mar 2018
- Published20 Mar 2018
About this course
Services and registering service providers are an inherent part of an Angular application. It is where you should define your application logic, they keep the state of the application and allow to share that among different components. That said, components can ask for instances of services by specifying them as parameters of their constructor functions which will then provided at runtime by Angular’s dependency injection mechanism. While services themselves are mostly just plain ES2015 classes, there are some interesting things to discover, especially when it comes to dependency injection. We can define services at various levels within our application, which allows us to control the scope and visibility of a given service.
What it covers
- 1Introducing Angular Service Injection with the Dependency Injector
- 2Define an Angular Service
- 3Register a Service to Angular’s Dependency Injection Mechanism
- 4Create Multiple Angular Service Instances
- 5Define an Aliased Class Provider in Angular
- 6Simplify an Angular Service using a JavaScript Object as a Value Provider
- 7Instantiate a Service using an Angular Factory Provider
- 8Pass Dependencies to a Factory Provider in Angular
- 9Overwrite a Service in a Component Subtree in Angular
- 10Use an Abstract Class as DI Token for your Services in Angular
- 11Control the dependency lookup with @Host, @SkipSelf and @Optional
- 12Avoid Multiple Service Instances in Lazy Loaded Modules in Angular
Similar Angular courses
Same topic, nearest in length, up to three from any one provider.
Data read from the egghead catalogue on 28 Nov 2026. How the data is collected.