angular-cn/public/docs/_examples/toh-4/ts/app/hero.service.1.ts
Patrice Chalin 2bd9946bda example(toh-4,5): getHeroesSlowly() to return getHeroes() (#2152)
* example(dart/toh-4,5): getHeroesSlowly() to return getHeroes()

Have `getHeroesSlowly()` delay and then return the value of
`getHeroes()`. This makes it easier for user’s performing the tutorial
to keep this slower method as they evolve toh-5 into toh-6.

* example(ts/toh-4,5): getHeroesSlowly() to return getHeroes()

Have `getHeroesSlowly()` delay and then return the value of
`getHeroes()`. This makes it easier for user’s performing the tutorial
to keep this slower method as they evolve toh-5 into toh-6.
2016-08-26 14:39:57 -07:00

25 lines
563 B
TypeScript

// #docplaster
// #docregion
// #docregion empty-class, full
import { Injectable } from '@angular/core';
// #enddocregion empty-class
import { Hero } from './hero';
import { HEROES } from './mock-heroes';
// #docregion empty-class, getHeroes-stub
@Injectable()
export class HeroService {
// #enddocregion empty-class, getHeroes-stub, full
/*
// #docregion getHeroes-stub
getHeroes(): void {} // stub
// #enddocregion getHeroes-stub
*/
// #docregion full
getHeroes(): Hero[] {
return HEROES;
}
// #docregion empty-class, getHeroes-stub
}