We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
HeroService#gerHero()
toh-pt5
1 parent 6d47b05 commit e239941Copy full SHA for e239941
aio/content/examples/toh-pt5/src/app/hero.service.ts
@@ -19,7 +19,9 @@ export class HeroService {
19
20
// #docregion getHero
21
getHero(id: number): Observable<Hero> {
22
- const hero = HEROES.find(h => h.id === id);
+ // For now, assume that a hero with the specified `id` always exists.
23
+ // Error handling will be added in the next step of the tutorial.
24
+ const hero = HEROES.find(h => h.id === id) as Hero;
25
this.messageService.add(`HeroService: fetched hero id=${id}`);
26
return of(hero);
27
}
0 commit comments