Skip to content

Commit

Permalink
docs: update @Injectable section
Browse files Browse the repository at this point in the history
  • Loading branch information
sreevani-ship-it committed Mar 30, 2018
1 parent 5a0b5e3 commit 4fb820c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions aio/content/guide/dependency-injection-in-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ in the `@Injectable()` decorator of the service itself.
<code-example path="dependency-injection/src/app/heroes/hero.service.3.ts" title="src/app/heroes/hero.service.3.ts" linenums="false">
</code-example>

`providedIn` here tells Angular that the root injector is responsible for creating an instance of `HeroService`
and making it automatically be made available to the entire
`providedIn` here tells Angular that the root injector is responsible for creating an instance of `HeroService`.
Services provided this way are automatically available to the entire
application and don't need to be listed in any module.


Expand Down Expand Up @@ -475,7 +475,7 @@ If the search is futile, the injector throws an error&mdash;unless the request w
A new injector has no providers.
Angular initializes the injectors it creates with some providers it cares about.
You have to register your _own_ application providers manually,
usually in the `@Injectable` decorator of the service, `providers` array of the `Component` or `Directive` metadata:
usually in the `@Injectable` decorator of the service, `providers` array of the `NgModule` or `Directive` metadata:

<code-example path="dependency-injection-in-action/src/app/app.component.ts" region="providers" title="src/app/app.component.ts (providers)">

Expand All @@ -493,7 +493,7 @@ The simple way of defining providers in the `@Injectable` decorator of the class
<code-example path="dependency-injection/src/app/heroes/hero.service.0.ts" title="src/app/heroes/hero.service.0.ts" linenums="false">
</code-example>

Another alternative is to mention the class in the providers array and you're done.
Another alternative is to mention the class in the providers array of the `@NgModule` and you're done.

<code-example path="dependency-injection-in-action/src/app/hero-bios.component.ts" region="class-provider" title="src/app/hero-bios.component.ts (class provider)" linenums="false">

Expand Down

0 comments on commit 4fb820c

Please sign in to comment.