docs: edit example to fetch hero before sending message (#40419)

PR Close #40419
This commit is contained in:
Valerij Dobler 2021-01-13 21:24:53 +01:00 committed by Alex Rickabaugh
parent 820d95ba40
commit 2a851c0924
1 changed files with 2 additions and 2 deletions

View File

@ -26,10 +26,10 @@ export class HeroService {
// #docregion getHeroes, getHeroes-1 // #docregion getHeroes, getHeroes-1
getHeroes(): Observable<Hero[]> { getHeroes(): Observable<Hero[]> {
// #enddocregion getHeroes-1 // #enddocregion getHeroes-1
// TODO: send the message _after_ fetching the heroes const heroes = of(HEROES);
this.messageService.add('HeroService: fetched heroes'); this.messageService.add('HeroService: fetched heroes');
// #docregion getHeroes-1 // #docregion getHeroes-1
return of(HEROES); return heroes;
} }
// #enddocregion getHeroes, getHeroes-1 // #enddocregion getHeroes, getHeroes-1
} }