4: Add Services
[examples/angular-tour-of-heroes] / src / app / hero.service.ts
1 import { Injectable } from '@angular/core';
2 import { Observable, of } from 'rxjs';
3 import { Hero } from './hero';
4 import { HEROES } from './mock-heroes';
5
6
7 @Injectable({
8   providedIn: 'root'
9 })
10 export class HeroService {
11
12   constructor() { }
13
14   getHeroes() : Observable<Hero[]> {
15     return of(HEROES);
16   }
17 }