From the course: Angular Essential Training (2019)

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

How Angular does dependency injection

How Angular does dependency injection - Angular Tutorial

From the course: Angular Essential Training (2019)

Start my 1-month free trial

How Angular does dependency injection

- [Instructor] Angular has dependency injection support baked into the framework. It's a big part of what allows you to create these components, directives, and more in a modular fashion, where they don't have to have knowledge of one another to coexist. With dependency injection, the framework is handling creating instances of things and injecting them into places where they are needed. In Angular, this is handled in two steps. The first is service registration, in which you provide angular with a list of things you want it to know about that can be injected. The second is the retrieval of those things, which can be done with constructor injection, either by leveraging TypeScript type annotations or by using the Angular Inject decorator. Angular also provides access to the injector itself for cases where you want to locate a service specifically, but this is typically not needed. The majority of application architecting…

Contents