4: Add Services
[examples/angular-tour-of-heroes] / src / app / hero.service.ts
index 7e0771a..a59d76b 100644 (file)
@@ -1,4 +1,5 @@
 import { Injectable } from '@angular/core';
+import { Observable, of } from 'rxjs';
 import { Hero } from './hero';
 import { HEROES } from './mock-heroes';
 
@@ -10,7 +11,7 @@ export class HeroService {
 
   constructor() { }
 
-  getHeroes() : Hero[] {
-    return HEROES;
+  getHeroes() : Observable<Hero[]> {
+    return of(HEROES);
   }
 }