5: Add In-app Navigation
[examples/angular-tour-of-heroes] / src / app / hero.service.ts
index 8df8f33..9003fe1 100644 (file)
@@ -16,4 +16,9 @@ export class HeroService {
     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));
+  }
 }