From 3d868da4b79e818d79cc658b22e06cf5be0bad4d Mon Sep 17 00:00:00 2001 From: Christopher Thorne Date: Sun, 29 May 2016 22:09:06 +0100 Subject: [PATCH] docs(toh-pt5): change getHero to match toh-pt6 getHero closes #1551 --- public/docs/_examples/toh-5/ts/app/hero.service.ts | 5 ++--- public/docs/ts/latest/tutorial/toh-pt5.jade | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/public/docs/_examples/toh-5/ts/app/hero.service.ts b/public/docs/_examples/toh-5/ts/app/hero.service.ts index fd6d5bb128..efc348509b 100644 --- a/public/docs/_examples/toh-5/ts/app/hero.service.ts +++ b/public/docs/_examples/toh-5/ts/app/hero.service.ts @@ -19,9 +19,8 @@ export class HeroService { //#docregion get-hero getHero(id: number) { - return Promise.resolve(HEROES).then( - heroes => heroes.filter(hero => hero.id === id)[0] - ); + return this.getHeroes() + .then(heroes => heroes.filter(hero => hero.id === id)[0]); } //#enddocregion get-hero } diff --git a/public/docs/ts/latest/tutorial/toh-pt5.jade b/public/docs/ts/latest/tutorial/toh-pt5.jade index 9d7f43629e..113c2f94db 100644 --- a/public/docs/ts/latest/tutorial/toh-pt5.jade +++ b/public/docs/ts/latest/tutorial/toh-pt5.jade @@ -427,7 +427,7 @@ code-example(format=''). The problem with this bit of code is that `HeroService` doesn't have a `getHero` method! We better fix that quickly before someone notices that we broke the app. - Open `HeroService` and add the `getHero` method. It's trivial given that we're still faking data access: + Open `HeroService` and add a `getHero` method that filters the heroes list from `getHeroes` by `id`: +makeExample('toh-5/ts/app/hero.service.ts', 'get-hero', 'app/hero.service.ts (getHero)')(format=".") :marked Return to the `HeroDetailComponent` to clean up loose ends.