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

docs(toh-pt5): change getHero to match toh-pt6 getHero #1551

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions public/docs/_examples/toh-5/ts/app/hero.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion public/docs/ts/latest/tutorial/toh-pt5.jade
Original file line number Diff line number Diff line change
Expand Up @@ -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 the `getHero` method. It's trivial given that we can access the heroes list:
+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.
Expand Down