X-Git-Url: https://juplo.de/gitweb/?p=examples%2Fangular-tour-of-heroes;a=blobdiff_plain;f=src%2Fapp%2Fhero.service.ts;h=9003fe1fb02718907bde31a3bfc4eb3bac35c734;hp=8df8f33af31d49fc5afa8f07ffe10b12a05e8b70;hb=f18faff7c576b595dd8765f36805aa8176122db7;hpb=0e69f63239442f2533e2c84f1de9179e726eaf04 diff --git a/src/app/hero.service.ts b/src/app/hero.service.ts index 8df8f33..9003fe1 100644 --- a/src/app/hero.service.ts +++ b/src/app/hero.service.ts @@ -16,4 +16,9 @@ export class HeroService { this.messageService.add('HeroService: fetching heroes...'); return of(HEROES); } + + getHero(id: number): Observable { + this.messageService.add(`HeroService: fetched hero id=${id}`); + return of(HEROES.find(hero => hero.id === id)); + } }