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

Commit df68dd6

Browse files
committed
post-review changes
1 parent 693f1db commit df68dd6

File tree

6 files changed

+69
-49
lines changed

6 files changed

+69
-49
lines changed

public/_includes/_util-fns.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ script.
222222
- // E.g. of a project relative path is 'app/main.ts'
223223
- if (ex.title === null || ex.title === undefined) {
224224
- // Title is not given so take it to be ex.filePath.
225-
- // Is title like styles.1.css? Then drop the '.1' qualifier:
226-
- var matches = ex.filePath.match(/^(.*)\.\d(\.\w+)$/);
225+
- // Title like styles.1.css or foo_1.dart? Then drop the '.1' or '_1' qualifier:
226+
- var matches = ex.filePath.match(/^(.*)[\._]\d(\.\w+)$/);
227227
- ex.title = matches ? matches[1] + matches[2] : ex.filePath;
228228
- }
229229
- ex.filePath = getExampleName() + '/' + _docsFor + '/' + ex.filePath;
Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,40 @@
11
// #docplaster
22
// #docregion , v2
33
import 'package:angular2/core.dart';
4+
// #enddocregion ,
5+
// #docregion v2
6+
import 'package:angular2/router.dart';
7+
// #docregion
48

59
import 'hero_service.dart';
610
import 'heroes_component.dart';
711

812
// #enddocregion v2
913
@Component(
10-
selector: 'my-app',
11-
template: '''
14+
selector: 'my-app',
15+
template: '''
1216
<h1>{{title}}</h1>
1317
<my-heroes></my-heroes>''',
14-
directives: const [HeroesComponent],
15-
providers: const [HeroService])
16-
// #enddocregion
18+
directives: const [HeroesComponent],
19+
providers: const [HeroService])
20+
// #enddocregion ,
21+
class Bogus {}
22+
1723
// #docregion v2
1824
@Component(
19-
selector: 'my-app',
20-
// #docregion template-v2
21-
template: '''
25+
selector: 'my-app',
26+
// #docregion template-v2
27+
template: '''
2228
<h1>{{title}}</h1>
2329
<a [routerLink]="['Heroes']">Heroes</a>
2430
<router-outlet></router-outlet>''',
25-
// #enddocregion template-v2
26-
directives: const [HeroesComponent],
27-
providers: const [HeroService])
28-
// #docregion , v2
31+
// #enddocregion template-v2
32+
directives: const [ROUTER_DIRECTIVES],
33+
providers: const [HeroService, ROUTER_PROVIDERS])
34+
@RouteConfig(const [
35+
const Route(path: '/heroes', name: 'Heroes', component: HeroesComponent)
36+
])
37+
// #docregion ,
2938
class AppComponent {
3039
String title = 'Tour of Heroes';
3140
}

public/docs/_examples/toh-5/dart/lib/hero_detail_component.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// #docplaster
22
// #docregion , v2
33
import 'dart:async';
4-
// #docregion goBack
4+
// #docregion dart-html
55
import 'dart:html';
6+
// #enddocregion dart-html
67

7-
// #enddocregion goBack
88
import 'package:angular2/core.dart';
99
// #docregion added-imports
1010
import 'package:angular2/router.dart';
@@ -23,9 +23,9 @@ import 'hero_service.dart';
2323
styleUrls: const ['hero_detail_component.css']
2424
// #docregion v2
2525
)
26-
// #docregion goBack, implement
26+
// #docregion implement
2727
class HeroDetailComponent implements OnInit {
28-
// #enddocregion goBack, implement
28+
// #enddocregion implement
2929
Hero hero;
3030
// #docregion ctor
3131
final HeroService _heroService;
@@ -41,9 +41,10 @@ class HeroDetailComponent implements OnInit {
4141
if (id != null) hero = await (_heroService.getHero(id));
4242
}
4343
// #enddocregion ngOnInit
44-
// #docregion goBack
4544

45+
// #docregion goBack
4646
void goBack() {
4747
window.history.back();
4848
}
49+
// #enddocregion goBack
4950
}

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ block intro-file-tree
2929
block keep-app-running
3030
:marked
3131
### Keep the app compiling and running
32+
3233
Open a terminal/console window.
3334
Start the Dart compiler, watch for changes, and start our server by entering the command:
3435

@@ -71,7 +72,7 @@ block router-config-intro
7172
The `AppComponent` doesn't have a router yet. We'll use the `@RouteConfig`
7273
annotation to simultaneously:
7374

74-
- Assign a router to the component and
75+
- Assign a router to the component
7576
- Configure that router with *routes*
7677

7778
block routerLink
@@ -96,10 +97,9 @@ block redirect-vs-use-as-default
9697

9798
block templateUrl-path-resolution
9899
:marked
99-
The given path must resolve to the named [asset][] within the
100-
application's package. Assests from other packages can also be accessed
101-
by providing a full package reference, such as
102-
`'package:some_other_package/dashboard_component.html'`.
100+
The value of `templateUrl` can be an [asset][] in this package or another
101+
package. To use an asset in another package, use a full package reference,
102+
such as `'package:some_other_package/dashboard_component.html'`.
103103

104104
[asset]: https://www.dartlang.org/tools/pub/glossary#asset
105105

@@ -118,6 +118,12 @@ block extract-id
118118
:marked
119119
Notice how we extract the `id` by calling the `RouteParams.get` method.
120120

121+
block dart-html
122+
:marked
123+
We'll also need to import `dart:html` to gain access to `window`.
124+
125+
+makeExcerpt('lib/hero_detail_component.dart', 'dart-html', '')
126+
121127
block heroes-component-cleanup
122128
:marked
123129
Because the template for `HeroesComponent` no longer uses `HeroDetailComponent`

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
@@ -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'
@@ -517,15 +519,15 @@ block route-params
517519
in the `ActivatedRoute` service and use the `HeroService` to fetch the hero with that `id`.
518520

519521
:marked
520-
Add requisite imports first:
522+
First, add the requisite imports:
521523

522524
- var _vers = _docsFor == 'dart' ? '' : '.1'
523525
+makeExcerpt('app/hero-detail.component' + _vers + '.ts', 'added-imports', '')
524526

525527
- var _ActivatedRoute = _docsFor == 'dart' ? 'RouteParams' : 'ActivatedRoute'
526528
:marked
527529
Let's have the `!{_ActivatedRoute}` service and the `HeroService` injected
528-
into the constructor with their values saved in private fields:
530+
into the constructor, saving their values in private fields:
529531

530532
+makeExcerpt('app/hero-detail.component.ts (constructor)', 'ctor')
531533

@@ -571,9 +573,12 @@ block extract-id
571573

572574
The user could click one of the two links in the `AppComponent`. Or click the browser's back button.
573575
We'll add a third option, a `goBack` method that navigates backward one step in the browser's history stack.
574-
576+
575577
+makeExcerpt('app/hero-detail.component.ts', 'goBack')
576578

579+
block dart-html
580+
//- N/A
581+
577582
- var _CanDeactivateGuard = _docsFor == 'dart' ? '<em>routerCanDeactivate</em> hook' : '<em>CanDeactivate</em> guard'
578583
- var _CanDeactivateGuardUri = _docsFor == 'dart' ? 'angular2.router/CanDeactivate-class' : 'router/index/CanDeactivate-interface'
579584
.l-sub-section
@@ -590,7 +595,8 @@ block extract-id
590595

591596
:marked
592597
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+
incremental improvement and migrate the template to its own file,
599+
called <span ngio-ex>hero-detail.component.html</span>:
594600

595601
+makeExcerpt('app/hero-detail.component.html')
596602

@@ -601,10 +607,6 @@ block extract-id
601607

602608
:marked
603609
Refresh the browser and see the results.
604-
Here's the (nearly) finished `HeroDetailComponent` but without the `@Input` !{_decorator} on `hero`
605-
&mdash; we'll be cleaning that out soon:
606-
607-
+makeExcerpt('app/hero-detail.component.ts', 'v2')
608610

609611
.l-main-section
610612
:marked
@@ -891,7 +893,7 @@ block file-tree-end
891893
.file index.html
892894
.file package.json
893895
.file styles.css
894-
.file systemjs.config.json
896+
.file systemjs.config.js
895897
.file tsconfig.json
896898
.file typings.json
897899

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
@@ -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'
@@ -517,15 +519,15 @@ block route-params
517519
in the `ActivatedRoute` service and use the `HeroService` to fetch the hero with that `id`.
518520

519521
:marked
520-
Add requisite imports first:
522+
First, add the requisite imports:
521523

522524
- var _vers = _docsFor == 'dart' ? '' : '.1'
523525
+makeExcerpt('app/hero-detail.component' + _vers + '.ts', 'added-imports', '')
524526

525527
- var _ActivatedRoute = _docsFor == 'dart' ? 'RouteParams' : 'ActivatedRoute'
526528
:marked
527529
Let's have the `!{_ActivatedRoute}` service and the `HeroService` injected
528-
into the constructor with their values saved in private fields:
530+
into the constructor, saving their values in private fields:
529531

530532
+makeExcerpt('app/hero-detail.component.ts (constructor)', 'ctor')
531533

@@ -571,9 +573,12 @@ block extract-id
571573

572574
The user could click one of the two links in the `AppComponent`. Or click the browser's back button.
573575
We'll add a third option, a `goBack` method that navigates backward one step in the browser's history stack.
574-
576+
575577
+makeExcerpt('app/hero-detail.component.ts', 'goBack')
576578

579+
block dart-html
580+
//- N/A
581+
577582
- var _CanDeactivateGuard = _docsFor == 'dart' ? '<em>routerCanDeactivate</em> hook' : '<em>CanDeactivate</em> guard'
578583
- var _CanDeactivateGuardUri = _docsFor == 'dart' ? 'angular2.router/CanDeactivate-class' : 'router/index/CanDeactivate-interface'
579584
.l-sub-section
@@ -590,7 +595,8 @@ block extract-id
590595

591596
:marked
592597
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+
incremental improvement and migrate the template to its own file,
599+
called <span ngio-ex>hero-detail.component.html</span>:
594600

595601
+makeExcerpt('app/hero-detail.component.html')
596602

@@ -601,10 +607,6 @@ block extract-id
601607

602608
:marked
603609
Refresh the browser and see the results.
604-
Here's the (nearly) finished `HeroDetailComponent` but without the `@Input` !{_decorator} on `hero`
605-
&mdash; we'll be cleaning that out soon:
606-
607-
+makeExcerpt('app/hero-detail.component.ts', 'v2')
608610

609611
.l-main-section
610612
:marked

0 commit comments

Comments
 (0)