Merge remote-tracking branch 'origin/master'
# Conflicts: # public/docs/ts/latest/guide/router.jade
This commit is contained in:
commit
3c5a045633
|
@ -13,7 +13,7 @@ else
|
|||
.c3.main-footer-branding
|
||||
.logo-inverse-large
|
||||
|
||||
.c3
|
||||
.c2
|
||||
h3.text-headline RESOURCES
|
||||
h3.text-headline 资源库
|
||||
|
||||
|
@ -31,7 +31,7 @@ else
|
|||
li <a href="/presskit.html">Press Kit</a>
|
||||
li <a href="/presskit.html">宣传资料</a>
|
||||
|
||||
.c3
|
||||
.c2
|
||||
h3.text-headline HELP
|
||||
h3.text-headline 帮助
|
||||
|
||||
|
@ -47,7 +47,7 @@ else
|
|||
li <a class="footer-feedback" ng-click="appCtrl.openFeedback()" aria-label="Submit feedback on this page"> Site Feedback</a>
|
||||
li <a class="footer-feedback" ng-click="appCtrl.openFeedback()" aria-label="Submit feedback on this page"> 网站反馈</a>
|
||||
|
||||
.c3
|
||||
.c2
|
||||
h3.text-headline COMMUNITY
|
||||
h3.text-headline 社区
|
||||
|
||||
|
@ -63,6 +63,11 @@ else
|
|||
li <a href="/contribute.html"> Contribute</a>
|
||||
li <a href="/contribute.html"> 做贡献</a>
|
||||
|
||||
.c2
|
||||
h3.text-headline LANGUAGES
|
||||
|
||||
ul.text-body
|
||||
li <a href="http://angular.cn/">中文版</a>
|
||||
|
||||
footer(class="background-steel")
|
||||
p
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"@angular/http": "2.0.0-rc.4",
|
||||
"@angular/platform-browser": "2.0.0-rc.4",
|
||||
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
|
||||
"@angular/router": "3.0.0-beta.1",
|
||||
"@angular/router": "3.0.0-beta.2",
|
||||
"@angular/router-deprecated": "2.0.0-rc.2",
|
||||
"@angular/upgrade": "2.0.0-rc.4",
|
||||
"angular2-in-memory-web-api": "0.0.14",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// #docregion
|
||||
// #docregion import
|
||||
// #docregion , import
|
||||
import 'package:angular2/core.dart';
|
||||
// #enddocregion import
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# #docregion
|
||||
name: angular2_getting_started
|
||||
name: angular2_quickstart
|
||||
description: QuickStart
|
||||
version: 0.0.1
|
||||
environment:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// #docregion
|
||||
import 'package:angular2/platform/browser.dart';
|
||||
|
||||
import 'package:angular2_getting_started/app_component.dart';
|
||||
import 'package:angular2_quickstart/app_component.dart';
|
||||
|
||||
void main() {
|
||||
bootstrap(AppComponent);
|
||||
|
|
|
@ -10,7 +10,7 @@ export const CrisisCenterRoutes: RouterConfig = [
|
|||
{
|
||||
path: '',
|
||||
redirectTo: '/crisis-center',
|
||||
terminal: true
|
||||
pathMatch: 'full'
|
||||
},
|
||||
// #enddocregion redirect
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ export const CrisisCenterRoutes: RouterConfig = [
|
|||
{
|
||||
path: '',
|
||||
redirectTo: '/crisis-center',
|
||||
terminal: true
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'crisis-center',
|
||||
|
|
|
@ -13,7 +13,7 @@ export const CrisisCenterRoutes: RouterConfig = [
|
|||
{
|
||||
path: '',
|
||||
redirectTo: '/crisis-center',
|
||||
terminal: true
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'crisis-center',
|
||||
|
|
|
@ -12,7 +12,7 @@ export const CrisisCenterRoutes: RouterConfig = [
|
|||
{
|
||||
path: '',
|
||||
redirectTo: '/crisis-center',
|
||||
terminal: true
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'crisis-center',
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<!-- #docregion base-href -->
|
||||
<base href=".">
|
||||
<base href="/">
|
||||
<!-- #enddocregion base-href -->
|
||||
<title>Router Sample v.1</title>
|
||||
<meta charset="UTF-8">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!-- #docregion -->
|
||||
<html>
|
||||
<head>
|
||||
<base href=".">
|
||||
<base href="/">
|
||||
<title>Router Sample v.2</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!-- #docregion -->
|
||||
<html>
|
||||
<head>
|
||||
<base href=".">
|
||||
<base href="/">
|
||||
<title>Router Sample v.3</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<!-- Set the base href -->
|
||||
<base href=".">
|
||||
<base href="/">
|
||||
<title>Router Sample</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
|
|
@ -11,7 +11,7 @@ export const routes: RouterConfig = [
|
|||
{
|
||||
path: '',
|
||||
redirectTo: '/dashboard',
|
||||
terminal: true
|
||||
pathMatch: 'full'
|
||||
},
|
||||
// #enddocregion redirect-route
|
||||
// #docregion dashboard-route
|
||||
|
|
|
@ -11,7 +11,7 @@ export const routes: RouterConfig = [
|
|||
{
|
||||
path: '',
|
||||
redirectTo: '/dashboard',
|
||||
terminal: true
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'dashboard',
|
||||
|
|
|
@ -9,7 +9,7 @@ export const routes: RouterConfig = [
|
|||
{
|
||||
path: '',
|
||||
redirectTo: '/dashboard',
|
||||
terminal: true
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'dashboard',
|
||||
|
|
|
@ -167,7 +167,7 @@ block server-watching
|
|||
|
||||
block project-file-structure
|
||||
.filetree
|
||||
.file angular2-quickstart
|
||||
.file angular2_quickstart
|
||||
.children
|
||||
.file lib
|
||||
.children
|
||||
|
|
|
@ -27,7 +27,7 @@ p Run the #[+liveExampleLink2('', 'toh-5')] for this part.
|
|||
and hero detail component. If not, we’ll need to go back and follow the previous chapters.
|
||||
|
||||
.filetree
|
||||
.file angular2-tour-of-heroes
|
||||
.file angular2_tour_of_heroes
|
||||
.children
|
||||
.file lib
|
||||
.children
|
||||
|
@ -659,7 +659,7 @@ p.
|
|||
|
||||
:marked
|
||||
.filetree
|
||||
.file angular2-tour-of-heroes
|
||||
.file angular2_tour_of_heroes
|
||||
.children
|
||||
.file lib
|
||||
.children
|
||||
|
|
|
@ -91,7 +91,7 @@ block review
|
|||
|
||||
block filetree
|
||||
.filetree
|
||||
.file angular2-tour-of-heroes
|
||||
.file angular2_tour_of_heroes
|
||||
.children
|
||||
.file lib
|
||||
.children
|
||||
|
|
|
@ -1891,26 +1891,21 @@ code-example(format="").
|
|||
它无法匹配上我们配置过的任何路由,这意味着在应用启动的时候它将不会显示任何组件。
|
||||
用户必须点击一个导航链接来触发导航并显示点什么。
|
||||
|
||||
We want the application to display the list of crises as it would if we pasted `localhost:3000/crisis-center/` into the address bar.
|
||||
We prefer that the application display the list of crises as it would if the user clicked the "Crisis Center" link or pasted `localhost:3000/crisis-center/` into the address bar.
|
||||
This is our intended default route.
|
||||
|
||||
当用户点击了“Crisis Center”链接或者在地址栏粘贴`localhost:3000/crisis-center/`时,我们更希望该应用能直接显示危机列表。这就是默认路由。
|
||||
|
||||
我们希望该应用显示一个危机列表,就像在地址栏输入`localhost:3000/crisis-center/`时一样。这就是默认路由。
|
||||
|
||||
We can arrange for that behavior in several ways.
|
||||
One way is to use a `redirect` to transparently navigate from one route to another.
|
||||
|
||||
我们可以用多种方式实现此行为。其一是使用`redirect`来从一个路由透明的导航到另一个。
|
||||
|
||||
In our example, we'll add a route to match our initial URL and redirect to our `crisis-center` route:
|
||||
|
||||
在这个例子中,我们将添加一个路由来匹配最初的URL,并重定向到`crisis-center`路由:
|
||||
|
||||
The preferred solution is to add a `redirect` route that transparently translates from the initial URL (`''`) to the preferred default path (`/crisis-center`):
|
||||
|
||||
首选的解决方案是添加一个`redirect`路由,它会透明的把初始URL(`''`)翻译成默认路径(`/crisis-center`)。
|
||||
|
||||
+makeExample('router/ts/app/crisis-center/crisis-center.routes.2.ts', 'redirect', 'app/crisis-center/crisis-center.routes.ts (redirect route)' )(format='.')
|
||||
|
||||
:marked
|
||||
Since we only want to redirect when our path specifically matches `''`, we've added an extra configuration
|
||||
to our route using `terminal: true`. Mainly for redirects, the `terminal` property tells the router
|
||||
whether or not it should continue matching our URL against the rest of our defined routes.
|
||||
A redirect route requires a `pathMatch` property to tell the router how to match a URL to the path of a route.
|
||||
In this app, the router should select the route to `CrisisCenterComponent` when the *entire URL* matches `''`,
|
||||
so we set the `pathMatch` value to `'full'`.
|
||||
|
||||
由于我们希望只有在路径明确的匹配到`''`时才重定向,所以我们往路由中添加了一个额外的配置项:`terminal: true`。
|
||||
主要是为了重定向,`terminal`属性是用来控制路由器是否应该继续匹配URL和我们定义的路由。(译者注:`terminal`设置为`true`时,该路由的优先级别就低于其他路由,只有在所有其他路由都不匹配的时候才最后匹配这个路由。主要是为了标示专用于重定向的路由而设计的。)
|
||||
|
@ -1918,7 +1913,14 @@ code-example(format="").
|
|||
.l-sub-section
|
||||
|
||||
:marked
|
||||
We'll discuss redirects further in a future update to this chapter.
|
||||
The other possible `pathMatch` value is `'prefix'` which tells the router
|
||||
to match the redirect route to _any_ URL that _begins_ with the redirect route's _prefix_ path.
|
||||
|
||||
That's not what we want in our use case. The `''` prefix path matches _every_ URL.
|
||||
We should redirect to the `CrisisCenterComponent` _only_ when the _entire_ url is `''`
|
||||
(or the equivalent `'/'`).
|
||||
|
||||
We'll discuss redirects in more detail in a future update to this chapter.
|
||||
|
||||
我们将在未来的更新中深入讨论重定向问题。
|
||||
|
||||
|
|
|
@ -146,9 +146,10 @@ h2#create-and-configure 步骤1:创建并配置项目
|
|||
h3 (a) Create the project folder
|
||||
h3 (a) 创建项目文件夹
|
||||
|
||||
- var _ = _docsFor == 'dart' ? '_' : '-';
|
||||
code-example(language="sh").
|
||||
mkdir angular2-quickstart
|
||||
cd angular2-quickstart
|
||||
mkdir angular2!{_}quickstart
|
||||
cd angular2!{_}quickstart
|
||||
|
||||
h3#add-config-files (b) Add #{_package_and_config_files}
|
||||
h3#add-config-files (b) 添加#{_package_and_config_filesCn}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
a(
|
||||
target="_blank"
|
||||
href="http://angularjs.blogspot.com/2016/06/rc4-now-available.html"
|
||||
) RC2 Now Available
|
||||
) RC4 Now Available
|
||||
p Today we’re happy to announce that we are shipping Angular 2.0.0-rc4. This release begins to lay the foundation for improved Angular Compilation, and makes improvements to testing....
|
||||
.author
|
||||
img(src="/resources/images/bios/stephenfluin.jpg")
|
||||
|
|
Loading…
Reference in New Issue