Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 3d868da

Browse files
Christopher Thornewardbell
Christopher Thorne
authored andcommitted
docs(toh-pt5): change getHero to match toh-pt6 getHero
closes #1551
1 parent a979c71 commit 3d868da

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

public/docs/_examples/toh-5/ts/app/hero.service.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ export class HeroService {
1919

2020
//#docregion get-hero
2121
getHero(id: number) {
22-
return Promise.resolve(HEROES).then(
23-
heroes => heroes.filter(hero => hero.id === id)[0]
24-
);
22+
return this.getHeroes()
23+
.then(heroes => heroes.filter(hero => hero.id === id)[0]);
2524
}
2625
//#enddocregion get-hero
2726
}

public/docs/ts/latest/tutorial/toh-pt5.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ code-example(format='').
427427
The problem with this bit of code is that `HeroService` doesn't have a `getHero` method!
428428
We better fix that quickly before someone notices that we broke the app.
429429

430-
Open `HeroService` and add the `getHero` method. It's trivial given that we're still faking data access:
430+
Open `HeroService` and add a `getHero` method that filters the heroes list from `getHeroes` by `id`:
431431
+makeExample('toh-5/ts/app/hero.service.ts', 'get-hero', 'app/hero.service.ts (getHero)')(format=".")
432432
:marked
433433
Return to the `HeroDetailComponent` to clean up loose ends.

0 commit comments

Comments
 (0)