* 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.
25 lines
563 B
TypeScript
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
|
|
}
|