docs: remove service from region where it was added before it was created (#35354)
The message service was added in a section create message service but was impoted much before it removed those imports because they can be confusing Fixes #35259 PR Close #35354
This commit is contained in:
parent
a6aa35e598
commit
e8ea3be843
|
@ -5,9 +5,9 @@ import { Observable } from 'rxjs';
|
||||||
class DummyHeroesComponent {
|
class DummyHeroesComponent {
|
||||||
|
|
||||||
heroes: Observable<Hero[]>;
|
heroes: Observable<Hero[]>;
|
||||||
|
// #docregion ctor
|
||||||
constructor(private heroService: HeroService) {}
|
constructor(private heroService: HeroService) {}
|
||||||
|
// #enddocregion ctor
|
||||||
// #docregion getHeroes
|
// #docregion getHeroes
|
||||||
getHeroes(): void {
|
getHeroes(): void {
|
||||||
// #docregion get-heroes
|
// #docregion get-heroes
|
||||||
|
|
|
@ -5,8 +5,8 @@ import { Component, OnInit } from '@angular/core';
|
||||||
import { Hero } from '../hero';
|
import { Hero } from '../hero';
|
||||||
// #docregion hero-service-import
|
// #docregion hero-service-import
|
||||||
import { HeroService } from '../hero.service';
|
import { HeroService } from '../hero.service';
|
||||||
import { MessageService } from '../message.service';
|
|
||||||
// #enddocregion hero-service-import
|
// #enddocregion hero-service-import
|
||||||
|
import { MessageService } from '../message.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-heroes',
|
selector: 'app-heroes',
|
||||||
|
|
|
@ -122,7 +122,7 @@ Replace the definition of the `heroes` property with a simple declaration.
|
||||||
|
|
||||||
Add a private `heroService` parameter of type `HeroService` to the constructor.
|
Add a private `heroService` parameter of type `HeroService` to the constructor.
|
||||||
|
|
||||||
<code-example path="toh-pt4/src/app/heroes/heroes.component.ts" header="src/app/heroes/heroes.component.ts" region="ctor">
|
<code-example path="toh-pt4/src/app/heroes/heroes.component.1.ts" header="src/app/heroes/heroes.component.ts" region="ctor">
|
||||||
</code-example>
|
</code-example>
|
||||||
|
|
||||||
The parameter simultaneously defines a private `heroService` property and identifies it as a `HeroService` injection site.
|
The parameter simultaneously defines a private `heroService` property and identifies it as a `HeroService` injection site.
|
||||||
|
|
Loading…
Reference in New Issue