...

/

Benefits of Three Levels of Injectors

Benefits of Three Levels of Injectors

Let's discuss the benefits of having these three levels of the injectors as Angular developers.

Isolation of concerns

Well, having the ability to set that a class can be injected at different levels allows us to create certain levels of isolation. We can, as we briefly discussed in the @Component Injector section, set it so that a service can only be injected at a component level or is only available at a certain module level.

This means we can create specialized services that perform one task, and are only needed in one place, if our Angular application needs to provide some business logic that is critical to the application but is ...