mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
@@ -6,7 +6,7 @@ Two main roles exist in the DI system: dependency consumer and dependency provid
|
||||
|
||||
Angular facilitates the interaction between dependency consumers and dependency providers using an abstraction called [Injector](guide/glossary#injector). When a dependency is requested, the injector checks its registry to see if there is an instance already available there. If not, a new instance is created and stored in the registry. Angular creates an application-wide injector (also known as "root" injector) during the application bootstrap process, as well as any other injectors as needed. In most cases you don't need to manually create injectors, but you should know that there is a layer that connects providers and consumers.
|
||||
|
||||
This topic covers basic scenarios of how a class can act as a dependency. Angular also allows you to use functions, objects, primitive types such as string or Boolean, or any other types as dependencies. For more information, see [Dependency providers](guide/dependency-injection-providers].
|
||||
This topic covers basic scenarios of how a class can act as a dependency. Angular also allows you to use functions, objects, primitive types such as string or Boolean, or any other types as dependencies. For more information, see [Dependency providers](guide/dependency-injection-providers).
|
||||
|
||||
## Providing dependency
|
||||
|
||||
@@ -81,4 +81,4 @@ When all requested services have been resolved and returned, Angular can call th
|
||||
* [Creating and injecting services](guide/creating-injectable-service)
|
||||
* [Dependency Injection in Action](guide/dependency-injection-in-action)
|
||||
|
||||
@reviewed 2022-08-02
|
||||
@reviewed 2022-08-02
|
||||
|
||||
Reference in New Issue
Block a user