parent
5cc1907f57
commit
2bcf442109
|
@ -45,7 +45,7 @@ include ../../../../_includes/_util-fns
|
||||||
Let's begin with a few core concepts of the Component Router.
|
Let's begin with a few core concepts of the Component Router.
|
||||||
Then we can explore the details through a sequence of examples.
|
Then we can explore the details through a sequence of examples.
|
||||||
### Setup
|
### Setup
|
||||||
The Component Router is an optional service that presents a particular component view for a given URL.
|
The Angular Component Router is an optional service that presents a particular component view for a given URL.
|
||||||
It is not part of the Angular 2 core. It is in its own library
|
It is not part of the Angular 2 core. It is in its own library
|
||||||
within the Angular npm bundle.
|
within the Angular npm bundle.
|
||||||
We make it available by loading its script in our `index.html`, after
|
We make it available by loading its script in our `index.html`, after
|
||||||
|
@ -66,7 +66,7 @@ include ../../../../_includes/_util-fns
|
||||||
:marked
|
:marked
|
||||||
### Configuration
|
### Configuration
|
||||||
When the browser's URL changes, the router looks for a corresponding **`RouteDefinition`**
|
When the browser's URL changes, the router looks for a corresponding **`RouteDefinition`**
|
||||||
from which it can determine the Component to display.
|
from which it can determine the component to display.
|
||||||
|
|
||||||
A new router has no route definitions. We have to configure it.
|
A new router has no route definitions. We have to configure it.
|
||||||
The preferred way to configure the router is with a **`@RouteConfig`** [decorator](glossary.html#decorator)
|
The preferred way to configure the router is with a **`@RouteConfig`** [decorator](glossary.html#decorator)
|
||||||
|
@ -79,7 +79,7 @@ include ../../../../_includes/_util-fns
|
||||||
.l-sub-section
|
.l-sub-section
|
||||||
:marked
|
:marked
|
||||||
There are several flavors of `RouteDefinition`.
|
There are several flavors of `RouteDefinition`.
|
||||||
The most common by far is the named **`Route`** which maps a URL path to a Component
|
The most common by far is the named **`Route`** which maps a URL path to a component
|
||||||
|
|
||||||
The `name` field is the name of the `Route`. The name **must** be spelled in **PascalCase**.
|
The `name` field is the name of the `Route`. The name **must** be spelled in **PascalCase**.
|
||||||
|
|
||||||
|
@ -139,11 +139,11 @@ table
|
||||||
tr
|
tr
|
||||||
td <code>@RouteConfig</code>
|
td <code>@RouteConfig</code>
|
||||||
td.
|
td.
|
||||||
Configures a router with <code>RouteDefinitions</code>, each mapping a URL path to a Component.
|
Configures a router with <code>RouteDefinitions</code>, each mapping a URL path to a component.
|
||||||
tr
|
tr
|
||||||
td <code>RouteDefinition</code>
|
td <code>RouteDefinition</code>
|
||||||
td.
|
td.
|
||||||
Defines how the router should navigate to a Component based on a URL pattern.
|
Defines how the router should navigate to a component based on a URL pattern.
|
||||||
tr
|
tr
|
||||||
td <code>Route</code>
|
td <code>Route</code>
|
||||||
td.
|
td.
|
||||||
|
@ -386,7 +386,7 @@ figure.image-display
|
||||||
Each definition translates to a [Route](https://angular.io/docs/ts/latest/api/router/Route-class.html) which has a
|
Each definition translates to a [Route](https://angular.io/docs/ts/latest/api/router/Route-class.html) which has a
|
||||||
* `path` - the URL path segment for this route
|
* `path` - the URL path segment for this route
|
||||||
* `name` - the name of the route
|
* `name` - the name of the route
|
||||||
* `component` - the Component associated with this route.
|
* `component` - the component associated with this route.
|
||||||
|
|
||||||
The router draws upon its registry of route definition when
|
The router draws upon its registry of route definition when
|
||||||
1. the browser URL changes
|
1. the browser URL changes
|
||||||
|
|
Loading…
Reference in New Issue