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

Commit c7f58ee

Browse files
committed
docs(router): incorporate Brian's comments; other fixes
closes #712
1 parent 38e75c8 commit c7f58ee

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

public/docs/_examples/router/ts/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99

1010
<title>Router Sample</title>
1111
<link rel="stylesheet" href="styles.css">
12+
13+
<!-- #docregion ie-polyfills -->
14+
<!-- IE required polyfills, in this exact order -->
15+
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
16+
<script src="node_modules/systemjs/distsystem-polyfills.js"></script>
17+
<!-- #enddocregion ie-polyfills -->
18+
1219
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
1320
<script src="node_modules/systemjs/dist/system.src.js"></script>
1421
<script src="node_modules/rxjs/bundles/Rx.js"></script>

public/docs/ts/latest/guide/router.jade

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ include ../../../../_includes/_util-fns
1010
We click the browser's back and forward buttons and the browser navigates
1111
backward and forward through the history of pages we've seen.
1212

13-
The Angular "**Component Router**" (AKA "the router") borrows from this model.
13+
The Angular "**Component Router**" ("the router") borrows from this model.
1414
It can interpret a browser URL as an instruction
1515
to navigate to a client-generated view and pass optional parameters along to the supporting view component
1616
to help it decide what specific content to present.
@@ -70,9 +70,9 @@ include ../../../../_includes/_util-fns
7070
When the browser's URL changes, the router looks for a corresponding **`RouteDefinition`**
7171
from which it can determine the component to display.
7272

73-
A new router has no route definitions. We have to configure it.
74-
The preferred way to configure the router is with a **`@RouteConfig`** [decorator](glossary.html#decorator)
75-
applied to a host component.
73+
A router has no route definitions until we configure it.
74+
The preferred way to simultaneously create a router and add its routes is with a **`@RouteConfig`** [decorator](glossary.html#decorator)
75+
applied to the router's host component.
7676

7777
In this example, we configure the top-level `AppComponent` with three route definitions
7878
+makeExample('router/ts/app/app.component.2.ts', 'route-config', 'app.component.ts (excerpt)')(format=".")
@@ -83,7 +83,8 @@ include ../../../../_includes/_util-fns
8383
There are several flavors of `RouteDefinition`.
8484
The most common by far is the named **`Route`** which maps a URL path to a component
8585

86-
The `name` field is the name of the `Route`. The name **must** be spelled in **PascalCase**.
86+
The `name` field is the route name which **must** be spelled in **PascalCase**
87+
to avoid potential confusion with the route `path`.
8788

8889
The `:id` in the third route is a token for a route parameter. In a URL such as `/hero/42`, "42"
8990
is the value of the `id` parameter. The corresponding `HeroDetailComponent`
@@ -268,7 +269,8 @@ figure.image-display
268269
<a id="load-library"></a>
269270
### Load the Component Router library
270271
The Component Router is not part of the Angular 2 core. It is in its own library.
271-
The router is an optional service and you might prefer a different router someday.
272+
The router is an optional service because not all applications need routing and,
273+
depending on your requirements, you may need a different routing library.
272274

273275
The Component Router library is part of the Angular npm bundle.
274276
We make it available by loading its script in our `index.html`, right after
@@ -287,9 +289,9 @@ figure.image-display
287289
"HTML 5 style" URLs.
288290

289291
We must **add a [&lt;base href> element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) tag**
290-
to the `index.html` to make this work.
291-
The `href` value specifies the base URL to use for all *relative* URLs within a document including
292-
links to css files, scripts, and images.
292+
to the `index.html` to make `pushState` routing work.
293+
The browser also needs the base `href` value to prefix *relative* URLs when downloading and linking to
294+
css files, scripts, and image.
293295

294296
Add the base element just after the `<head>` tag.
295297
If the `app` folder is the application root, as it is for our application,
@@ -817,7 +819,7 @@ code-example(format="").
817819
:marked
818820
Notice that the **path ends with a slash and three trailing periods (`/...`)**.
819821

820-
That means this is an incomplete route (AKA a ***non-terminal route***). The finished route will be some combination of
822+
That means this is an incomplete route (a ***non-terminal route***). The finished route will be some combination of
821823
the parent `/crisis-center/` route and a route from the **child router** that belongs to the designated component.
822824

823825
All is well.

tools/plunker-builder/indexHtmlTranslator.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ var _rxData = [
7878
from: 'node_modules/angular2/bundles/testing.dev.js',
7979
to: 'https://code.angularjs.org/2.0.0-beta.0/testing.dev.js'
8080
},
81+
{
82+
pattern: 'script',
83+
from: 'node_modules/es6-shim/es6-shim.min.js',
84+
to: 'https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.min.js'
85+
},
86+
{
87+
pattern: 'script',
88+
from: 'node_modules/systemjs/distsystem-polyfills.js',
89+
to: 'https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.16/system-polyfills.js'
90+
},
8191
{
8292
pattern: 'link',
8393
from: 'node_modules/bootstrap/dist/css/bootstrap.min.css',

0 commit comments

Comments
 (0)