Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 343b03a

Browse files
authored
docs(hierarchical-di): clarify that component injector may be a proxy (#3248)
closes #3242 and #3246
1 parent feb3473 commit 343b03a

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

public/docs/ts/latest/guide/hierarchical-dependency-injection.jade

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,18 @@ block includes
2020
In the [Dependency Injection](./dependency-injection.html) guide,
2121
you learned how to configure a dependency injector and how to retrieve dependencies where you need them.
2222

23-
In fact, there is no such thing as *the* injector.
23+
In fact, there is no such thing as ***the*** injector.
2424
An application may have multiple injectors.
25-
An Angular application is a tree of components. Each component instance has its own injector!
25+
An Angular application is a tree of components. Each component instance has its own injector.
2626
The tree of components parallels the tree of injectors.
2727

28+
.l-sub-section
29+
:marked
30+
The component's injector may be a _proxy_ for an ancestor injector higher in the component tree.
31+
That's an implementation detail that improves efficiency.
32+
You won't notice the difference and
33+
your mental model should be that every component has its own injector.
34+
2835
:marked
2936
Consider this guide's variation on the Tour of Heroes application.
3037
At the top is the `AppComponent` which has some sub-components.
@@ -37,14 +44,6 @@ figure.image-display
3744
img(src="/resources/images/devguide/dependency-injection/component-hierarchy.png" alt="injector tree" width="600")
3845

3946
:marked
40-
Angular doesn't actually _create_ a separate injector for each component.
41-
Every component doesn't need its own injector and it would be horribly inefficient to create
42-
masses of injectors for no good purpose.
43-
44-
But every component _has an injector_, even if it shares that injector with another component or with the injector of the root `AppModule`.
45-
And there _may_ be multiple injector instances operating at different levels of the component tree
46-
depending upon how the developer registers providers, which is the subject of this guide.
47-
4847
### Injector bubbling
4948

5049
When a component requests a dependency, Angular tries to satisfy that dependency with a provider registered in that component's own injector.

0 commit comments

Comments
 (0)