docs(aio): fix TOH inclusion of HeroesService. (#21228)
Change docs where the MessageService is referenced Fixes #20398 PR Close #21228
This commit is contained in:
parent
7e928db204
commit
545fdf10e2
|
@ -21,7 +21,14 @@ import { MessagesComponent } from './messages/messages.component';
|
||||||
FormsModule
|
FormsModule
|
||||||
],
|
],
|
||||||
// #docregion providers
|
// #docregion providers
|
||||||
providers: [ HeroService, MessageService ],
|
// #docregion providers-heroservice
|
||||||
|
providers: [
|
||||||
|
HeroService,
|
||||||
|
// #enddocregion providers-heroservice
|
||||||
|
MessageService
|
||||||
|
// #docregion providers-heroservice
|
||||||
|
],
|
||||||
|
// #enddocregion providers-heroservice
|
||||||
// #enddocregion providers
|
// #enddocregion providers
|
||||||
bootstrap: [ AppComponent ]
|
bootstrap: [ AppComponent ]
|
||||||
})
|
})
|
||||||
|
|
|
@ -97,7 +97,7 @@ Since you did not, you'll have to provide it yourself.
|
||||||
|
|
||||||
Open the `AppModule` class, import the `HeroService`, and add it to the `@NgModule.providers` array.
|
Open the `AppModule` class, import the `HeroService`, and add it to the `@NgModule.providers` array.
|
||||||
|
|
||||||
<code-example path="toh-pt4/src/app/app.module.ts" linenums="false" title="src/app/app.module.ts (providers)" region="providers">
|
<code-example path="toh-pt4/src/app/app.module.ts" linenums="false" title="src/app/app.module.ts (providers)" region="providers-heroservice">
|
||||||
</code-example>
|
</code-example>
|
||||||
|
|
||||||
The `providers` array tells Angular to create a single, shared instance of `HeroService`
|
The `providers` array tells Angular to create a single, shared instance of `HeroService`
|
||||||
|
@ -105,6 +105,12 @@ and inject into any class that asks for it.
|
||||||
|
|
||||||
The `HeroService` is now ready to plug into the `HeroesComponent`.
|
The `HeroService` is now ready to plug into the `HeroesComponent`.
|
||||||
|
|
||||||
|
<div class="alert is-important">
|
||||||
|
|
||||||
|
This is a interim code sample that will allow you to provide and use the `HeroService`. At this point, the code will differ from the `HeroService` in the ["final code review"](#final-code-review).
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="alert is-helpful">
|
<div class="alert is-helpful">
|
||||||
|
|
||||||
Learn more about _providers_ in the [Providers](guide/providers) guide.
|
Learn more about _providers_ in the [Providers](guide/providers) guide.
|
||||||
|
@ -423,6 +429,10 @@ Here are the code files discussed on this page and your app should look like thi
|
||||||
path="toh-pt4/src/app/messages/messages.component.css">
|
path="toh-pt4/src/app/messages/messages.component.css">
|
||||||
</code-pane>
|
</code-pane>
|
||||||
|
|
||||||
|
<code-pane title="src/app/app.module.ts"
|
||||||
|
path="toh-pt4/src/app/app.module.ts">
|
||||||
|
</code-pane>
|
||||||
|
|
||||||
<code-pane title="src/app/app.component.html"
|
<code-pane title="src/app/app.component.html"
|
||||||
path="toh-pt4/src/app/app.component.html">
|
path="toh-pt4/src/app/app.component.html">
|
||||||
</code-pane>
|
</code-pane>
|
||||||
|
|
Loading…
Reference in New Issue