Guide: Dependency Injection
Improve this DocDependency Injection
Dependency Injection (DI) is a software design pattern that deals with how components get hold of their dependencies.
The Angular injector subsystem is in charge of creating components, resolving their dependencies, and providing them to other components as requested.
Using Dependency Injection
DI is pervasive throughout Angular. You can use it when defining components or when providing run
and config
blocks for a module.
-
Components such as services, directives, filters, and animations are defined by an injectable factory method or constructor function. These components c