5: Add In-app Navigation
[examples/angular-tour-of-heroes] / src / app / hero.service.ts
index d0801f3..9003fe1 100644 (file)
@@ -13,6 +13,12 @@ export class HeroService {
   constructor(private messageService : MessageService) { }
 
   getHeroes() : Observable<Hero[]> {
+    this.messageService.add('HeroService: fetching heroes...');
     return of(HEROES);
   }
+
+  getHero(id: number): Observable<Hero> {
+    this.messageService.add(`HeroService: fetched hero id=${id}`);
+    return of(HEROES.find(hero => hero.id === id));
+  }
 }