Patrice Chalin c1440e7eff [review-pending] docs(dev guide): server-communication - new prose
New Dart prose, update Dart and Ts code

+ guide/server-communication/ts: update to docs and example code
+ guide/server-communication/dart: new prose, update example code
+ ignore all npm-debug.logs
+ make Jade ul li TOC elements more compact.
2016-05-13 21:32:54 +01:00

29 lines
689 B
TypeScript

// #docplaster
// #docregion
// #docregion just-get-heroes
import { Injectable } from '@angular/core';
import { Hero } from './hero';
import { HEROES } from './mock-heroes';
@Injectable()
export class HeroService {
// #docregion get-heroes
getHeroes() {
return Promise.resolve(HEROES);
}
// #enddocregion get-heroes
// #enddocregion just-get-heroes
// See the "Take it slow" appendix
// #docregion get-heroes-slowly
getHeroesSlowly() {
return new Promise<Hero[]>(resolve =>
setTimeout(()=>resolve(HEROES), 2000) // 2 seconds
);
}
// #enddocregion get-heroes-slowly
// #docregion just-get-heroes
}
// #enddocregion just-get-heroes
// #enddocregion