From b2f2fb87ec16d750309b5c24d8d2ccd6ea752245 Mon Sep 17 00:00:00 2001 From: Foxandxss Date: Tue, 15 Mar 2016 13:24:50 +0100 Subject: [PATCH] docs(toh): make a few corrections closes #967 --- .../toh-1/ts-snippets/app.component.snippets.pt1.ts | 2 +- public/docs/_examples/toh-1/ts/app/app.component.ts | 2 +- public/docs/_examples/toh-4/ts/app/hero.service.ts | 3 ++- public/docs/_examples/toh-5/ts/app/dashboard.component.html | 2 +- public/docs/ts/latest/tutorial/toh-pt4.jade | 4 ++-- public/docs/ts/latest/tutorial/toh-pt5.jade | 5 ++++- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/public/docs/_examples/toh-1/ts-snippets/app.component.snippets.pt1.ts b/public/docs/_examples/toh-1/ts-snippets/app.component.snippets.pt1.ts index e4a9796bc8..ffcc45d2f6 100644 --- a/public/docs/_examples/toh-1/ts-snippets/app.component.snippets.pt1.ts +++ b/public/docs/_examples/toh-1/ts-snippets/app.component.snippets.pt1.ts @@ -26,7 +26,7 @@ template:`
{{hero.id}}
-
+
` // #enddocregion editing-Hero diff --git a/public/docs/_examples/toh-1/ts/app/app.component.ts b/public/docs/_examples/toh-1/ts/app/app.component.ts index 47d34e87a4..59074565e7 100644 --- a/public/docs/_examples/toh-1/ts/app/app.component.ts +++ b/public/docs/_examples/toh-1/ts/app/app.component.ts @@ -16,7 +16,7 @@ interface Hero {
{{hero.id}}
-
+
` }) diff --git a/public/docs/_examples/toh-4/ts/app/hero.service.ts b/public/docs/_examples/toh-4/ts/app/hero.service.ts index b503ebed24..e81c261105 100644 --- a/public/docs/_examples/toh-4/ts/app/hero.service.ts +++ b/public/docs/_examples/toh-4/ts/app/hero.service.ts @@ -1,9 +1,10 @@ // #docplaster // #docregion // #docregion just-get-heroes +import {Injectable} from 'angular2/core'; + import {Hero} from './hero'; import {HEROES} from './mock-heroes'; -import {Injectable} from 'angular2/core'; @Injectable() export class HeroService { diff --git a/public/docs/_examples/toh-5/ts/app/dashboard.component.html b/public/docs/_examples/toh-5/ts/app/dashboard.component.html index e6d5afd974..a5bafd7702 100644 --- a/public/docs/_examples/toh-5/ts/app/dashboard.component.html +++ b/public/docs/_examples/toh-5/ts/app/dashboard.component.html @@ -2,7 +2,7 @@

Top Heroes

-
+

{{hero.name}}

diff --git a/public/docs/ts/latest/tutorial/toh-pt4.jade b/public/docs/ts/latest/tutorial/toh-pt4.jade index ee4a171267..68b93b2cc9 100644 --- a/public/docs/ts/latest/tutorial/toh-pt4.jade +++ b/public/docs/ts/latest/tutorial/toh-pt4.jade @@ -34,7 +34,7 @@ include ../_util-fns .file hero-detail.component.ts .file main.ts .file node_modules ... - .file typings ... + .file typings ... .file index.html .file package.json .file tsconfig.json @@ -70,7 +70,7 @@ code-example(format="." language="bash"). .l-sub-section :marked We've adopted a convention in which we spell the name of a service in lowercase followed by `.service`. - If the service name were multi-word, we'd spell the base filename with lower dash case (AKA kebab-case). + If the service name were multi-word, we'd spell the base filename with lower dash case (AKA "kebab-case"). The `SpecialSuperHeroService` would be defined in the `special-super-hero.service.ts` file. :marked We name the class `HeroService` and export it for others to import. diff --git a/public/docs/ts/latest/tutorial/toh-pt5.jade b/public/docs/ts/latest/tutorial/toh-pt5.jade index 11dae5d778..23c308eda3 100644 --- a/public/docs/ts/latest/tutorial/toh-pt5.jade +++ b/public/docs/ts/latest/tutorial/toh-pt5.jade @@ -411,6 +411,9 @@ code-example(format=''). We inject the both the `RouteParams` service and the `HeroService` into the constructor as we've done before, making private variables for both: +makeExample('toh-5/ts/app/hero-detail.component.ts', 'ctor', 'app/hero-detail.component.ts (constructor)')(format=".") +:marked + We tell the class that we want to implement the `OnInit` interface. ++makeExample('toh-5/ts/app/hero-detail.component.ts', 'implement')(format=".") :marked Inside the `ngOnInit` lifecycle hook, extract the `id` parameter value from the `RouteParams` service and use the `HeroService` to fetch the hero with that `id`. @@ -679,7 +682,7 @@ figure.image-display ## Recap ### The Road Behind - We travelled a great distance in this chapter + We travelled a great distance in this chapter. - We added the Angular *Component Router* to navigate among different components. - We learned how to create router links to represent navigation menu items - We used router parameters to navigate to the details of user selected hero