Skip to content

Commit 6d47b05

Browse files
gkalpakmhevery
authored andcommitted
docs: align toh-pt5 code with toh-pt4 (angular#41234)
This commit aligns the code of `HeroService` `getHeroes()` and `getHero()` methods in `toh-pt5` with that of `toh-pt4`. I.e. it applies the changes from angular#40419 to `toh-pt5`. PR Close angular#41234
1 parent 81d2aab commit 6d47b05

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

aio/content/examples/toh-pt5/src/app/hero.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ export class HeroService {
1212
constructor(private messageService: MessageService) { }
1313

1414
getHeroes(): Observable<Hero[]> {
15-
// TODO: send the message _after_ fetching the heroes
15+
const heroes = of(HEROES);
1616
this.messageService.add('HeroService: fetched heroes');
17-
return of(HEROES);
17+
return heroes;
1818
}
1919

2020
// #docregion getHero
2121
getHero(id: number): Observable<Hero> {
22-
// TODO: send the message _after_ fetching the hero
22+
const hero = HEROES.find(h => h.id === id);
2323
this.messageService.add(`HeroService: fetched hero id=${id}`);
24-
return of(HEROES.find(hero => hero.id === id));
24+
return of(hero);
2525
}
2626
// #enddocregion getHero
2727
}

0 commit comments

Comments
 (0)