parent
3777cf55aa
commit
f4be101c08
|
@ -25,7 +25,7 @@ You can configure an injector with a service class, you can provide a substitute
|
||||||
## Dependency injection tokens
|
## Dependency injection tokens
|
||||||
|
|
||||||
When you configure an [injector](guide/glossary#injector) with a [provider](guide/glossary#provider), you are associating that provider with a [dependency injection token](guide/glossary#di-token), or DI token.
|
When you configure an [injector](guide/glossary#injector) with a [provider](guide/glossary#provider), you are associating that provider with a [dependency injection token](guide/glossary#di-token), or DI token.
|
||||||
The injector allows Angular create a map of any internal dependencies.
|
The injector allows Angular to create a map of any internal dependencies.
|
||||||
The DI token acts as a key to that map.
|
The DI token acts as a key to that map.
|
||||||
|
|
||||||
The dependency value is an instance, and the class type serves as a lookup key.
|
The dependency value is an instance, and the class type serves as a lookup key.
|
||||||
|
@ -56,7 +56,7 @@ Angular expands the `providers` value into a full provider object as follows.
|
||||||
<code-example path="dependency-injection/src/app/providers.component.ts" region="providers-3" >
|
<code-example path="dependency-injection/src/app/providers.component.ts" region="providers-3" >
|
||||||
</code-example>
|
</code-example>
|
||||||
|
|
||||||
The expanded provider configuration is an object literal with two properties.
|
The expanded provider configuration is an object literal with two properties:
|
||||||
|
|
||||||
* The `provide` property holds the [token](#token)
|
* The `provide` property holds the [token](#token)
|
||||||
that serves as the key for both locating a dependency value and configuring the injector.
|
that serves as the key for both locating a dependency value and configuring the injector.
|
||||||
|
|
Loading…
Reference in New Issue