6 min read
•Question 8 of 46mediumDependency Injection
Angular DI system and providers.
What is Dependency Injection?
DI is a design pattern where dependencies are provided to a class rather than created by the class. Angular has a built-in DI system.
Injection Hierarchy
- Root level: providedIn: 'root'
- Module level: providers array in NgModule
- Component level: providers array in @Component