@@ -46,7 +46,7 @@ figure.image-display
4646:marked
4747 ## Where We Left Off
4848
49- Before we continue with our Tour of Heroes, let’s verify that
49+ Before we continue with our Tour of Heroes, let’s verify that
5050 we have the following structure after adding our hero service
5151 and hero detail component. If not, we’ll need to go back and follow the previous chapters.
5252
@@ -105,7 +105,7 @@ block keep-app-running
105105
106106 Our current app loads `AppComponent` and immediately displays the list of heroes.
107107
108- Our revised app should present a shell with a choice of views (*Dashboard* and *Heroes*)
108+ Our revised app should present a shell with a choice of views (*Dashboard* and *Heroes*)
109109 and then default to one of them.
110110
111111 The `AppComponent` should only handle navigation.
@@ -135,9 +135,9 @@ block keep-app-running
135135 * Create the file <span ngio-ex>app/app.component.ts</span>.
136136 * Define an <span if-docs="ts">exported</span> `AppComponent` class.
137137 * Add an `@Component` !{_decorator} above the class with a `my-app` selector.
138- * Move from `HeroesComponent` to `AppComponent` the
139- * `title` class property, and
140- * `@Component` template `<h1>` element containing a `title` binding.
138+ * Move the following from `HeroesComponent` to `AppComponent`:
139+ * `title` class property
140+ * `@Component` template `<h1>` element, which contains a binding to `title`
141141 * Add a `<my-heroes>` element to the app template just below the heading so we still see the heroes.
142142 * Add `HeroesComponent` to the `!{_declsVsDirectives}` !{_array} of `!{_AppModuleVsAppComp}` so Angular recognizes the `<my-heroes>` tags.
143143 * Add `HeroService` to the `providers` !{_array} of `!{_AppModuleVsAppComp}` because we'll need it in every other view.
@@ -171,8 +171,8 @@ block app-comp-v1
171171block angular-router
172172 :marked
173173 The Angular router is an external, optional Angular NgModule called `RouterModule`.
174- The router is a combination of multiple provided services (`RouterModule`),
175- multiple directives (`RouterOutlet, RouterLink, RouterLinkActive`),
174+ The router is a combination of multiple provided services (`RouterModule`),
175+ multiple directives (`RouterOutlet, RouterLink, RouterLinkActive`),
176176 and a configuration (`Routes`). We'll configure our routes first.
177177
178178:marked
@@ -185,7 +185,7 @@ block angular-router
185185.callout.is-important
186186 header base href is essential
187187 :marked
188- See the *base href* section of the [Router](../guide/router.html#!#base-href)
188+ See the *base href* section of the [Router](../guide/router.html#!#base-href)
189189 chapter to learn why this matters.
190190
191191a#configure-routes
@@ -213,7 +213,7 @@ block router-config-intro
213213 This *route definition* has the following parts:
214214
215215 - **path**: the router matches this route's path to the URL in the browser address bar (`/heroes`).
216- <li if-docs="dart"> **name**: the official name of the route;
216+ <li if-docs="dart"> **name**: the official name of the route;
217217 it *must* begin with a capital letter to avoid confusion with the *path* (`Heroes`).</li>
218218 - **component**: the component that the router should create when navigating to this route (`HeroesComponent`).
219219
@@ -315,7 +315,7 @@ block routerLink
315315
316316 Go back to `!{_appRoutingTsVsAppComp}` and teach it to navigate to the dashboard.
317317
318- Import `DashboardComponent` and
318+ Import the dashboard component and
319319 add the following route definition to the `!{_RoutesVsAtRouteConfig}` !{_array} of definitions.
320320
321321- var _file = _docsFor == ' dart' ? ' lib/app_component.dart' : ' app/app.routing.ts'
@@ -346,6 +346,8 @@ block redirect-vs-use-as-default
346346 Learn about the *redirects* in the [Routing](../guide/router.html#!#redirect) chapter.
347347
348348:marked
349+ #### Add navigation to the template
350+
349351 Finally, add a dashboard navigation link to the template, just above the *Heroes* link.
350352
351353- var _vers = _docsFor == ' dart' ? ' ' : ' .1'
@@ -443,7 +445,7 @@ block redirect-vs-use-as-default
443445 The new route is a bit unusual in that we must tell the `HeroDetailComponent` *which hero to show*.
444446 We didn't have to tell the `HeroesComponent` or the `DashboardComponent` anything.
445447
446- At the moment the parent `HeroesComponent` sets the component's `hero` property to a
448+ At the moment the parent `HeroesComponent` sets the component's `hero` property to a
447449 hero object with a binding like this.
448450
449451code-example( language ="html" ) .
@@ -455,7 +457,7 @@ code-example(language="html").
455457
456458 ### Parameterized route
457459
458- We *can* add the hero's `id` to the URL. When routing to the hero whose `id` is 11,
460+ We *can* add the hero's `id` to the URL. When routing to the hero whose `id` is 11,
459461 we could expect to see an URL such as this:
460462
461463code-example( format ='' ) .
@@ -475,9 +477,10 @@ code-example(format='').
475477:marked
476478 The colon (:) in the path indicates that `:id` is a placeholder to be filled with a specific hero `id`
477479 when navigating to the `HeroDetailComponent`.
480+
478481.l-sub-section
479482 :marked
480- Remember to import `HeroDetailComponent` before creating this route.
483+ Remember to import the hero detail component before creating this route.
481484
482485+ ifDocsFor('ts|js' )
483486 :marked
@@ -517,15 +520,15 @@ block route-params
517520 in the `ActivatedRoute` service and use the `HeroService` to fetch the hero with that `id`.
518521
519522:marked
520- Add requisite imports first :
523+ First, add the requisite imports:
521524
522525- var _vers = _docsFor == ' dart' ? ' ' : ' .1'
523526+ makeExcerpt('app/hero-detail.component' + _vers + '.ts' , 'added-imports' , '' )
524527
525528- var _ActivatedRoute = _docsFor == ' dart' ? ' RouteParams' : ' ActivatedRoute'
526529:marked
527530 Let's have the `!{_ActivatedRoute}` service and the `HeroService` injected
528- into the constructor with their values saved in private fields:
531+ into the constructor, saving their values in private fields:
529532
530533+ makeExcerpt('app/hero-detail.component.ts (constructor)' , 'ctor' )
531534
@@ -574,6 +577,9 @@ block extract-id
574577
575578+ makeExcerpt('app/hero-detail.component.ts' , 'goBack' )
576579
580+ block dart-html
581+ //- N/A
582+
577583- var _CanDeactivateGuard = _docsFor == ' dart' ? ' <em>routerCanDeactivate</em> hook' : ' <em>CanDeactivate</em> guard'
578584- var _CanDeactivateGuardUri = _docsFor == ' dart' ? ' angular2.router/CanDeactivate-class' : ' router/index/CanDeactivate-interface'
579585.l-sub-section
@@ -589,8 +595,9 @@ block extract-id
589595+ makeExcerpt('app/hero-detail.component.html' , 'back-button' , '' )
590596
591597:marked
592- Modifing the template to add this button spurs us to take one more
593- incremental improvement and migrate the template to its own file:
598+ Modifing the template to add this button spurs us to take one more
599+ incremental improvement and migrate the template to its own file,
600+ called <span ngio-ex>hero-detail.component.html</span>:
594601
595602+ makeExcerpt('app/hero-detail.component.html' )
596603
@@ -601,10 +608,6 @@ block extract-id
601608
602609:marked
603610 Refresh the browser and see the results.
604- Here's the (nearly) finished `HeroDetailComponent` but without the `@Input` !{_decorator} on `hero`
605- — we'll be cleaning that out soon:
606-
607- + makeExcerpt('app/hero-detail.component.ts' , 'v2' )
608611
609612.l-main-section
610613:marked
@@ -725,7 +728,7 @@ figure.image-display
725728 :marked
726729 The `styleUrls` property is !{_an} !{_array} of style file names (with paths).
727730 We could list multiple style files from different locations if we needed them.
728- <span if-docs="ts">As with `templateUrl`, we must specify the path _all the way
731+ <span if-docs="ts">As with `templateUrl`, we must specify the path _all the way
729732 back to the application root_.</span>
730733
731734block heroes-component-cleanup
@@ -777,10 +780,10 @@ block heroes-component-cleanup
777780
778781:marked
779782 ### Stylish Hero Details
780-
783+
781784 The designers also gave us CSS styles specifically for the `HeroDetailComponent`.
782785
783- Add a <span ngio-ex>hero-detail.component.css</span> to the `!{_appDir}`
786+ Add a <span ngio-ex>hero-detail.component.css</span> to the `!{_appDir}`
784787 folder and refer to that file inside
785788 the `styleUrls` !{_array} as we did for `DashboardComponent`.
786789 Let's also remove the `hero` property `@Input` !{_decorator}
@@ -891,7 +894,7 @@ block file-tree-end
891894 .file index.html
892895 .file package.json
893896 .file styles.css
894- .file systemjs.config.json
897+ .file systemjs.config.js
895898 .file tsconfig.json
896899 .file typings.json
897900
0 commit comments