As an Angular developer, I appreciate what the dependency injector does for me. It provides structure to my applications. It gives me the tools to organize my code into coherent components and then combine them in a loosely coupled way.
Dependency injection is a boon to testing too; testability is indeed often given as the primary motivation for doing DI, though for me its more like a positive side effect of the primary benefit, which is the loosely coupled design you get.
As much as I appreciate it, I also recognize that Angular's dependency injector is one of the most criticised parts of the framework. Some people don't like the idea of a JavaScript DI framework in general, while some people have more of an issue with Angular's implementation specifically. I think the critics do have a point - there are definitely some issues with the way DI is implemented in Angular - but it is not nearly as bad as it's sometimes made out to be.
In this article we'll build up a simplified version of the Angular injector. It'll hopefully help you understand what exactly the injector does.
Your new post is loading...