Dependency Injection

Dependency injection can be a difficult concept to fully grasp. However, it is a very important part of AngularJS, and after you understand the basics, the AngularJS implementation becomes quite clear. Dependency injection is a well-known design pattern in many server-side languages but has not been used extensively in a JavaScript framework until AngularJS.

The idea of AngularJS dependency injection is to define and dynamically inject a dependency object into another object, making available all the functionality provided by the dependency object. AngularJS provides dependency injection through the use of providers and an injector service.

Providers

A provider is essentially a definition of how to create an instance of ...

Get Learning AngularJS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.