X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Fapp%2Fhero.service.ts;h=9003fe1fb02718907bde31a3bfc4eb3bac35c734;hb=d42007487362bd314434f11dc26c3a291e7ff4e7;hp=8df8f33af31d49fc5afa8f07ffe10b12a05e8b70;hpb=3daace5a71b0be19e05b74de9cf7530ce6aa92c3;p=examples%2Fangular-tour-of-heroes 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)); + } }