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

Commit 615a8d4

Browse files
docs(guide/hierarchical-injectors): fix typo
1 parent ff5f21f commit 615a8d4

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ include ../../../../_includes/_util-fns
99
that parallel an application's component tree.
1010
We can re-configure the injectors at any level of that component tree with
1111
interesting and useful results.
12-
12+
1313
In this chapter we explore these points and write some code.
14-
14+
1515
[Live Example](/resources/live-examples/hierarchical-dependency-injection/ts/plnkr.html).
1616

1717
.l-main-section
@@ -21,19 +21,19 @@ include ../../../../_includes/_util-fns
2121
In the [Dependency Injection](./dependency-injection.html) chapter
2222
we learned how to configure a dependency injector and how to retrieve dependencies where we need them.
2323

24-
We oversimplified. In fact, there is no such thing as ***the*** injector!
24+
We oversimplified. In fact, there is no such thing as ***the*** injector!
2525
An application may have multiple injectors!
2626

2727
An Angular application is a tree of components. Each component instance has its own injector!
2828
The tree of components parallels the tree of injectors.
29-
29+
3030

3131
.l-sub-section
3232
:marked
33-
Angular doesn't *literally* create a separate injector for each component.
34-
Every component doesn't need its own injector and it would be horribly inefficient to create
33+
Angular doesn't *literally* create a separate injector for each component.
34+
Every component doesn't need its own injector and it would be horribly inefficient to create
3535
masses of injectors for no good purpose.
36-
36+
3737
But it is true that every component ***has an injector*** (even if it shares that injector with another component)
3838
and there may be many different injector instances operating at different levels of the component tree.
3939

@@ -135,12 +135,12 @@ figure.image-display
135135

136136
Our `HeroEditComponent` uses this services under the hood for it’s `hero` property. It intercepts the `get` and `set` method to delegate the actual work to our `RestoreService` which in turn makes sure that we won’t work on the original item but on a copy instead.
137137

138-
At this point we may be scratching our heads asking what this has to do with component injectors?
139-
If closely at the metadata for our `HeroEditComponent`. Notice the `providers` property.
138+
At this point we may be scratching our heads asking what this has to do with component injectors?
139+
Look closely at the metadata for our `HeroEditComponent`. Notice the `providers` property.
140140

141141
+makeExample('hierarchical-dependency-injection/ts/app/hero-editor.component.ts', 'providers')
142142
:marked
143-
This adds a `RestoreService` provider to the injector of the `HeroEditComponent`.
143+
This adds a `RestoreService` provider to the injector of the `HeroEditComponent`.
144144
Couldn’t we simply alter our bootstrap call to this?
145145

146146
+makeExample('hierarchical-dependency-injection/ts/app/boot.ts', 'bad-alternative')
@@ -155,11 +155,11 @@ figure.image-display
155155
Any of those injectors could have its own instance of the service.
156156

157157
If we defined a `RestoreService` provider only on the root component,
158-
we would have exactly one instance of that service and it would be shared across the entire application.
159-
158+
we would have exactly one instance of that service and it would be shared across the entire application.
159+
160160
That’s clearly not what we want in this scenario. We want each component to have its own instance of the `RestoreService`.
161161
Defining (or re-defining) a provider at the component level creates a new instance of the service for each new instance
162-
of that component. We've made the `RestoreService` a kind of "private" singleton for each `HeroEditComponent`,
162+
of that component. We've made the `RestoreService` a kind of "private" singleton for each `HeroEditComponent`,
163163
scoped to that component instance and its child components.
164164

165165
<!--

0 commit comments

Comments
 (0)