4: Add Services
[examples/angular-tour-of-heroes] / src / app / hero.service.ts
diff --git a/src/app/hero.service.ts b/src/app/hero.service.ts
new file mode 100644 (file)
index 0000000..7e0771a
--- /dev/null
@@ -0,0 +1,16 @@
+import { Injectable } from '@angular/core';
+import { Hero } from './hero';
+import { HEROES } from './mock-heroes';
+
+
+@Injectable({
+  providedIn: 'root'
+})
+export class HeroService {
+
+  constructor() { }
+
+  getHeroes() : Hero[] {
+    return HEROES;
+  }
+}