Skip to content

Instantly share code, notes, and snippets.

@ericxyan
Last active March 11, 2016 07:07
Show Gist options
  • Save ericxyan/eee8d96a39d9b2207f86 to your computer and use it in GitHub Desktop.
Save ericxyan/eee8d96a39d9b2207f86 to your computer and use it in GitHub Desktop.
test
import {Hero} from './hero';
import {HEROES} from './mock-heroes';
import {Injectable} from 'angular2/core';
@Injectable()
export class HeroService {
getHeroes() {
return Promise.resolve(HEROES);
}
// See the "Take it slow" appendix
getHeroesSlowly() {
return new Promise<Hero[]>(resolve =>
setTimeout(()=>resolve(HEROES), 2000) // 2 seconds
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment