diff --git a/aio/content/guide/pipes.md b/aio/content/guide/pipes.md index df7848e352..a7e1fb51d6 100644 --- a/aio/content/guide/pipes.md +++ b/aio/content/guide/pipes.md @@ -270,13 +270,9 @@ Note the following:
-
+
Remember the declarations array
- Remember the declarations array - - 别忘了`declarations`数组 - -
+
别忘了`declarations`数组
You must register custom pipes. If you don't, Angular reports an error. @@ -686,13 +682,9 @@ It displays the same hero data in JSON format by chaining through to the built-i
-
+
Debugging with the json pipe
- Debugging with the json pipe - - 借助json管道进行调试 - -
+
借助json管道进行调试
The [JsonPipe](api/common/JsonPipe) provides an easy way to diagnosis a mysteriously failing data binding or diff --git a/aio/content/guide/router.md b/aio/content/guide/router.md index 958ab4f910..b879f1986e 100644 --- a/aio/content/guide/router.md +++ b/aio/content/guide/router.md @@ -838,6 +838,8 @@ Here are the key `Router` terms and their meanings: a route. Clicking an element with a routerLink directive that is bound to a string or a link parameters array triggers a navigation. + 这个指令把可点击的 HTML 元素绑定到某个路由。点击带有 routerLink 指令(绑定到字符串链接参数数组)的元素时就会触发一次导航。 + @@ -1040,7 +1042,7 @@ The application has three main feature areas: Try it by clicking on this live example link. -点击试用一下。 +点击试用一下。 Once the app warms up, you'll see a row of navigation buttons and the *Heroes* view with its list of heroes. @@ -1203,13 +1205,9 @@ set the `href` value in **`index.html`** *exactly* as shown here.
-
+
Live example note
- Live example note - - 在线例子说明 - -
+
在线例子说明
A live coding environment like Stackblitz sets the application base address dynamically so you can't specify a fixed address. That's why the example code replaces the `` with a script that writes the `` tag on the fly. @@ -1965,7 +1963,7 @@ This example recreates the heroes feature in the "Services" episode of the and you'll be copying much of the code from the . -这个例子重写了[《英雄指南》](tutorial/toh-pt4 "Tour of Heroes: Services")的“服务”部分的英雄列表特性,我们可以从中赋值大部分代码过来。 +这个例子重写了[《英雄指南》](tutorial/toh-pt4 "Tour of Heroes: Services")的“服务”部分的英雄列表特性,我们可以从中赋值大部分代码过来。 Here's how the user will experience this version of the app: @@ -2018,7 +2016,7 @@ Follow these steps: * Copy into it the contents of the `app.component.ts` from the "Services" tutorial. - 把教程中的“服务”部分的代码复制到`app.component.ts`中。 + 把复制到`app.component.ts`中。 * Make a few minor but necessary changes: @@ -2477,8 +2475,12 @@ pull the hero `id` from the parameters and retrieve the hero to display. The `paramMap` processing is a bit tricky. When the map changes, you `get()` the `id` parameter from the changed parameters. +`paramMap` 的处理过程有点稍复杂。当这个 map 的值变化时,你可以从变化之后的参数中 `get()` 到其 `id` 参数。 + Then you tell the `HeroService` to fetch the hero with that `id` and return the result of the `HeroService` request. +然后,让 `HeroService` 去获取一个具有此 `id` 的英雄,并返回这个 `HeroService` 请求的结果。 + You might think to use the RxJS `map` operator. But the `HeroService` returns an `Observable`. So you flatten the `Observable` with the `switchMap` operator instead. @@ -2496,8 +2498,6 @@ The observable `Subscription` will be handled by the `AsyncPipe` and the compone #### _ParamMap_ API -#### _ParamMap_ 参数 API - The `ParamMap` API is inspired by the [URLSearchParams interface](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams). It provides methods to handle parameter access for both route parameters (`paramMap`) and query parameters (`queryParamMap`). @@ -4055,6 +4055,8 @@ router will wait for the observable to resolve to `true` or `false`. The router supports multiple guard interfaces: +路由器可以支持多种守卫接口: + * [`CanActivate`](api/router/CanActivate) to mediate navigation *to* a route. 用[`CanActivate`](api/router/CanActivate)来处理导航*到*某路由的情况。 @@ -4900,6 +4902,8 @@ and fragment to the next route. The `queryParamsHandling` feature also provides a `merge` option, which will preserve and combine the current query parameters with any provided query parameters when navigating. +`queryParamsHandling` 特性还提供了 `merge` 选项,它将会在导航时保留当前的查询参数,并与其它查询参数合并。 +
Since you'll be navigating to the *Admin Dashboard* route after logging in, you'll update it to handle the diff --git a/aio/content/guide/structural-directives.md b/aio/content/guide/structural-directives.md index 8bcff98389..719c57083b 100644 --- a/aio/content/guide/structural-directives.md +++ b/aio/content/guide/structural-directives.md @@ -80,13 +80,9 @@ and how to [write your own](guide/structural-directives#unless) structural direc
-
+
Directive spelling
- Directive spelling - - 指令的拼写形式 - -
+
指令的拼写形式
Throughout this guide, you'll see a directive spelled in both _UpperCamelCase_ and _lowerCamelCase_. Already you've seen `NgIf` and `ngIf`. diff --git a/aio/content/guide/template-syntax.md b/aio/content/guide/template-syntax.md index 6d3dc296cb..750d0d3bd6 100644 --- a/aio/content/guide/template-syntax.md +++ b/aio/content/guide/template-syntax.md @@ -836,13 +836,9 @@ This fact bears repeating:
-
+
A world without attributes
- A world without attributes - - 没有 attribute 的世界 - -
+
没有 attribute 的世界
In the world of Angular, the only role of attributes is to initialize element and directive state. When you write a data binding, you're dealing exclusively with properties and events of the target object. @@ -1891,13 +1887,9 @@ Angular 为此提供一种特殊的_双向数据绑定_语法:**`[(x)]`**。
-
+
[( )] = banana in a box
- [( )] = banana in a box - - [( )] = 盒子里的香蕉 - -
+
[( )] = 盒子里的香蕉
Visualize a *banana in a box* to remember that the parentheses go _inside_ the brackets. diff --git a/aio/content/guide/upgrade.md b/aio/content/guide/upgrade.md index d56e2b8327..dc117e3ea6 100644 --- a/aio/content/guide/upgrade.md +++ b/aio/content/guide/upgrade.md @@ -868,13 +868,9 @@ components. The expressions themselves are still regular AngularJS expressions.
-
+
Use kebab-case for downgraded component attributes
- Use kebab-case for downgraded component attributes - - 在降级过的组件属性中使用中线命名法 - -
+
在降级过的组件属性中使用中线命名法
There's one notable exception to the rule of using Angular attribute syntax for downgraded components. It has to do with input or output names that consist