Angular dependency injection supplies a class with the objects it needs
Answer: Dependency injection is a design pattern used to organize and share code across an application. You supply dependencies to a class instead of creating them inside it. A dependency is any object, value, function, or service that a class needs but does not create itself.
Why Angular uses it
DI helps you reuse functionality as an application grows. It supports a clearer separation of concerns, makes code easier to refactor, and lets unit tests substitute test doubles for real implementations.
You interact with the system in two main ways: you provide a dependency, or you inject a provided dependency into a class that needs it.
Injectors
Concrete injectors implement the Injector interface. They are configured with providers that associate dependency types with injection tokens. Injector.get retrieves an instance from the injector based on a provided token.
See also
Claims
- id: C1 claim: DI supplies dependencies to a class instead of creating them inside it. source: S1 evidence: "by supplying dependencies to a class instead of creating them inside it."
- id: C2 claim: A dependency is something a class needs but does not create itself. source: S1 evidence: "A dependency is any object, value, function, or service"
- id: C3 claim: Concrete injectors implement the Injector interface. source: S2 evidence: "Concrete injectors implement this interface."
- id: C4 claim: get retrieves an instance from the injector by token. source: S2 evidence: "Retrieves an instance from the injector based on the provided token."
Sources
- [S1] Dependency injection in Angular. Angular docs. https://angular.dev/guide/di . License: CC BY 4.0. Accessed 2026-11-11.
- [S2] Injector. Angular source. https://github.com/angular/angular/blob/main/packages/core/src/di/injector.ts . License: MIT. Accessed 2026-11-11.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: Angular documentation (angular/angular adev): Copyright (c) 2010-2026 Google LLC; CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Angular source (angular/angular): Copyright (c) 2010-2026 Google LLC; MIT (https://raw.githubusercontent.com/angular/angular/main/LICENSE). Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Angular docs, CC BY 4.0 text (angular/angular adev footer); Angular source, MIT (angular/angular). Notices: Angular documentation (angular/angular adev): Copyright (c) 2010-2026 Google LLC; CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Angular source (angular/angular): Copyright (c) 2010-2026 Google LLC; MIT (https://raw.githubusercontent.com/angular/angular/main/LICENSE).
Cite this
iinventedlight. 2026. "Angular dependency injection supplies classes with their dependencies." iinventedlight Library, iil:note:cqs3aevy, version of 2026-11-11. https://iinventedlight.com/library/notes/angular-dependency-injection/. License: CC-BY-4.0.
@misc{iil_note_cqs3aevy,
author = {{iinventedlight}},
title = {{Angular dependency injection supplies classes with their dependencies}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-11},
url = {https://iinventedlight.com/library/notes/angular-dependency-injection/},
note = {Permanent ID iil:note:cqs3aevy. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/angular-dependency-injection.md.