Created
April 27, 2018 17:50
-
-
Save nerdic-coder/d409813fd695bd21b2c6a84f7b4195a7 to your computer and use it in GitHub Desktop.
hero.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Observable } from 'rxjs'; | |
import { of } from 'rxjs'; | |
import { Hero } from '../models/hero'; | |
import { HEROES } from './mock-heroes'; | |
export class HeroService { | |
private static _instance: HeroService; | |
getHeroes(): Observable<Hero[]> { | |
return of(HEROES); | |
} | |
public static get Instance(): HeroService { | |
// Do you need arguments? Make it a regular method instead. | |
return this._instance || (this._instance = new this()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment