Angular Dependency Injection — Using “Injector” Service instead of long list of services in Component’s constructor
2 min readDec 15, 2022
--
The Angular framework provides Dependency Injection (DI) out of the box. The easiest way to understand DI is to “Delegate creation of instance task to a global authority and just ask for the instance when you want to use it”.
Let’s make it simple, when we create a new service say OrdersService
and provide it in a Root module, the @Injector({ providedIn:'root'})
decorator let Angular compiler know to register this class in a DI registry…