mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
docs: remove MessageService information from HeroService section (#51501)
PR Close #51501
This commit is contained in:
parent
440684ddb4
commit
1a1d0c90bf
1 changed files with 1 additions and 4 deletions
|
|
@ -20,10 +20,7 @@ This tutorial creates a `HeroService` that all application classes can use to ge
|
|||
Instead of creating that service with the [`new` keyword](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/new), use the [*dependency injection*](guide/dependency-injection) that Angular supports to inject it into the `HeroesComponent` constructor.
|
||||
|
||||
Services are a great way to share information among classes that *don't know each other*.
|
||||
Create a `MessageService` next and inject it in these two places.
|
||||
|
||||
* Inject in `HeroService`, which uses the service to send a message
|
||||
* Inject in `MessagesComponent`, which displays that message, and also displays the ID when the user clicks a hero
|
||||
Create a `HeroService` next and inject it in the `HeroesComponent`, to provide hero data.
|
||||
|
||||
## Create the `HeroService`
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue