4: Add Services
[examples/angular-tour-of-heroes] / src / app / heroes / heroes.component.ts
index 94f4266..1e29d4e 100644 (file)
@@ -24,6 +24,8 @@ export class HeroesComponent implements OnInit {
   }
 
   getHeroes() : void {
-    this.heroes = this.heroService.getHeroes();
+    this.heroService
+        .getHeroes()
+        .subscribe(heroes => this.heroes = heroes);
   }
 }