From fc58e0eee0e48afd673a42ce29340f7724afe4ff Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Wed, 7 Mar 2018 14:35:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=88=E5=B9=B6=E7=AC=AC=E4=BA=8C?= =?UTF-8?q?=E7=89=88=E7=9A=84=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/content/guide/api-page-class.md | 4 +- aio/content/guide/architecture.md | 4 +- aio/content/guide/bootstrapping.md | 9 + aio/content/guide/browser-support.md | 4 +- aio/content/guide/cheatsheet.md | 435 +++++++++++++--- aio/content/guide/comparing-observables.md | 14 +- aio/content/guide/component-interaction.md | 14 +- .../guide/dependency-injection-in-action.md | 2 +- aio/content/guide/docs-style-guide.md | 38 +- aio/content/guide/glossary.md | 4 +- aio/content/guide/http.md | 13 +- aio/content/guide/lifecycle-hooks.md | 2 +- aio/content/guide/module-types.md | 66 +++ aio/content/guide/ngmodule-api.md | 10 +- aio/content/guide/ngmodule-faq.md | 2 +- aio/content/guide/ngmodule-vs-jsmodule.md | 2 + aio/content/guide/ngmodules.md | 6 + aio/content/guide/pipes.md | 2 +- aio/content/guide/quickstart.md | 34 +- aio/content/guide/reactive-forms.md | 6 +- aio/content/guide/router.md | 24 +- aio/content/guide/security.md | 64 +-- aio/content/guide/set-document-title.md | 2 +- aio/content/guide/singleton-services.md | 10 + aio/content/guide/structural-directives.md | 3 - aio/content/guide/styleguide.md | 22 +- aio/content/guide/template-syntax.md | 10 +- aio/content/guide/testing-observables.md | 2 + aio/content/guide/testing.md | 485 +++++++++++++++++- aio/content/guide/upgrade.md | 4 +- aio/content/guide/visual-studio-2015.md | 72 +-- aio/content/marketing/docs.md | 20 +- aio/content/tutorial/toh-pt6.md | 2 + 33 files changed, 1072 insertions(+), 319 deletions(-) diff --git a/aio/content/guide/api-page-class.md b/aio/content/guide/api-page-class.md index 55cd6b10be..a00a5e606f 100644 --- a/aio/content/guide/api-page-class.md +++ b/aio/content/guide/api-page-class.md @@ -128,7 +128,7 @@ Description - 描述 + 说明 @@ -311,7 +311,7 @@ }[], duration: number, delay: number, easing: string, previousPlayers: any[]) - + diff --git a/aio/content/guide/architecture.md b/aio/content/guide/architecture.md index 880dfa750e..b42f7f40e8 100644 --- a/aio/content/guide/architecture.md +++ b/aio/content/guide/architecture.md @@ -57,7 +57,7 @@ NgModules are a big deal. This page introduces modules; the [NgModules](guide/ngmodules) pages relating to NgModules covers them in detail. -_Angular 模块_很重要。这里只是简单介绍,在 [Angular 模块](guide/ngmodule)中会做深入讲解。 +NgModules 很重要。这里只是简单介绍,在 [NgModules](guide/ngmodule)中会做深入讲解。
@@ -229,7 +229,7 @@ Hang in there. The confusion yields to clarity with time and experience. Learn more from the [NgModules](guide/ngmodules) page. - 更多信息,见 [Angular 模块](guide/ngmodule)。 + 更多信息,参见 [NgModules](guide/ngmodule)。 diff --git a/aio/content/guide/bootstrapping.md b/aio/content/guide/bootstrapping.md index 6d277083a5..83e89687bc 100644 --- a/aio/content/guide/bootstrapping.md +++ b/aio/content/guide/bootstrapping.md @@ -1,5 +1,7 @@ # Bootstrapping +# 启动过程 + #### Prerequisites A basic understanding of the following: @@ -152,6 +154,8 @@ the class was imported from another module. You don't have any services to provide yet. But you will create some before long and you may chose to provide many of them here. +我们还没有提供任何服务,但是很快就会创建一些,而且可能也会选择在这里提供它们。 + {@a bootstrap-array} ## The `providers` array @@ -172,6 +176,9 @@ Each bootstrapped component is the base of its own tree of components. Inserting a bootstrapped component usually triggers a cascade of component creations that fill out that tree. +每个被引导的组件都是它自己的组件树的根。 +插入一个被引导的组件通常触发一系列组件的创建并形成组件树。 + While you can put more than one component tree on a host web page, most applications have only one component tree and bootstrap a single root component. @@ -180,5 +187,7 @@ root module's `bootstrap` array. ## More about Angular Modules +## 关于Angular模块的更多知识 + For more on NgModules you're likely to see frequently in apps, see [Frequently Used Modules](#). diff --git a/aio/content/guide/browser-support.md b/aio/content/guide/browser-support.md index 6b132ebec9..83c15ca5a5 100644 --- a/aio/content/guide/browser-support.md +++ b/aio/content/guide/browser-support.md @@ -414,9 +414,11 @@ Here are the features which may require additional polyfills: [JIT compilation](guide/aot-compiler). + [JIT 编译](guide/aot-compiler) + Required to reflect for metadata. - [JIT 编译](guide/aot-compiler) 需要 reflect 来提供元数据。 + 需要 reflect 来提供元数据。 diff --git a/aio/content/guide/cheatsheet.md b/aio/content/guide/cheatsheet.md index 06a90de8bd..6de60ba8b6 100644 --- a/aio/content/guide/cheatsheet.md +++ b/aio/content/guide/cheatsheet.md @@ -1,5 +1,7 @@

Cheat Sheet

+

速查表

+
@@ -11,7 +13,9 @@ - @@ -44,7 +52,9 @@ - @@ -72,7 +86,11 @@ - @@ -84,9 +102,13 @@ - @@ -97,7 +119,11 @@ is available to declarations of this module.

- @@ -109,7 +135,11 @@ is available to declarations of this module.

- @@ -121,7 +151,11 @@ is available to declarations of this module.

- @@ -154,7 +188,11 @@ is available to declarations of this module.

- @@ -166,7 +204,11 @@ is available to declarations of this module.

- @@ -178,7 +220,11 @@ is available to declarations of this module.

- @@ -190,7 +236,11 @@ is available to declarations of this module.

- @@ -202,7 +252,11 @@ is available to declarations of this module.

- @@ -214,9 +268,13 @@ is available to declarations of this module.

- @@ -227,7 +285,11 @@ is available to declarations of this module.

- @@ -239,7 +301,11 @@ is available to declarations of this module.

- @@ -251,7 +317,11 @@ is available to declarations of this module.

- @@ -263,7 +333,9 @@ is available to declarations of this module.

- @@ -276,7 +348,11 @@ is available to declarations of this module.

- @@ -288,7 +364,11 @@ is available to declarations of this module.

- @@ -300,7 +380,11 @@ is available to declarations of this module.

- @@ -312,7 +396,11 @@ is available to declarations of this module.

- @@ -329,7 +417,9 @@ is available to declarations of this module.

- @@ -357,7 +451,11 @@ is available to declarations of this module.

- @@ -369,7 +467,11 @@ is available to declarations of this module.

- @@ -381,7 +483,11 @@ is available to declarations of this module.

- @@ -395,7 +501,9 @@ is available to declarations of this module.

- @@ -412,7 +520,9 @@ is available to declarations of this module.

- @@ -445,7 +559,9 @@ is available to declarations of this module.

- @@ -473,7 +593,11 @@ is available to declarations of this module.

- @@ -485,7 +609,11 @@ is available to declarations of this module.

- @@ -497,7 +625,9 @@ is available to declarations of this module.

- @@ -547,7 +685,11 @@ is available to declarations of this module.

- @@ -564,7 +706,10 @@ is available to declarations of this module.

- @@ -592,7 +741,11 @@ so the @Directive configuration applies to components as well

- @@ -604,7 +757,11 @@ so the @Directive configuration applies to components as well

- @@ -616,7 +773,11 @@ so the @Directive configuration applies to components as well

- @@ -633,7 +794,9 @@ so the @Directive configuration applies to components as well

- @@ -662,7 +829,11 @@ so the @Directive configuration applies to components as well

- @@ -674,7 +845,11 @@ so the @Directive configuration applies to components as well

- @@ -686,7 +861,11 @@ so the @Directive configuration applies to components as well

- @@ -698,7 +877,11 @@ so the @Directive configuration applies to components as well

- @@ -710,7 +893,11 @@ so the @Directive configuration applies to components as well

- @@ -722,7 +909,11 @@ so the @Directive configuration applies to components as well

- @@ -734,7 +925,11 @@ so the @Directive configuration applies to components as well

- @@ -751,7 +946,9 @@ so the @Directive configuration applies to components as well

- @@ -779,7 +980,11 @@ so the @Directive configuration applies to components as well

- @@ -791,7 +996,11 @@ so the @Directive configuration applies to components as well

- @@ -803,7 +1012,11 @@ so the @Directive configuration applies to components as well

- @@ -815,7 +1028,11 @@ so the @Directive configuration applies to components as well

- @@ -827,7 +1044,11 @@ so the @Directive configuration applies to components as well

- @@ -839,7 +1060,11 @@ so the @Directive configuration applies to components as well

- @@ -851,7 +1076,11 @@ so the @Directive configuration applies to components as well

- @@ -863,7 +1092,11 @@ so the @Directive configuration applies to components as well

- @@ -894,7 +1127,11 @@ so the @Directive configuration applies to components as well

- @@ -906,7 +1143,11 @@ so the @Directive configuration applies to components as well

- @@ -918,7 +1159,11 @@ so the @Directive configuration applies to components as well

- @@ -935,7 +1180,9 @@ so the @Directive configuration applies to components as well

- @@ -963,7 +1214,11 @@ so the @Directive configuration applies to components as well

- @@ -975,7 +1230,11 @@ so the @Directive configuration applies to components as well

- @@ -987,7 +1246,11 @@ so the @Directive configuration applies to components as well

- @@ -999,7 +1262,11 @@ so the @Directive configuration applies to components as well

- @@ -1011,7 +1278,11 @@ so the @Directive configuration applies to components as well

- @@ -1023,7 +1294,11 @@ so the @Directive configuration applies to components as well

- @@ -1035,7 +1310,11 @@ so the @Directive configuration applies to components as well

- @@ -1047,7 +1326,11 @@ so the @Directive configuration applies to components as well

- diff --git a/aio/content/guide/comparing-observables.md b/aio/content/guide/comparing-observables.md index 978560e14e..0b9c12754f 100644 --- a/aio/content/guide/comparing-observables.md +++ b/aio/content/guide/comparing-observables.md @@ -69,6 +69,8 @@ sub.unsubscribe(); ### Error handling +### 错误处理 + * Observable execution errors are delivered to the subscriber's error handler, and the subscriber automatically unsubscribes from the observable. @@ -259,7 +261,7 @@ let subscription = clicks$ // Stop listening subscription.unsubscribe(); - + + @@ -311,14 +313,18 @@ button.removeEventListener(‘click’, handler); - - @@ -1355,6 +1345,8 @@ Use HTML tables to present tabular data. Routing + 路由 + @@ -1457,6 +1453,8 @@ Here is the markup for this table. Routing + 路由 + @@ -54,6 +58,8 @@ typical characteristics, in real world apps, you may see hybrids. Domain + 领域 + @@ -80,6 +88,8 @@ typical characteristics, in real world apps, you may see hybrids. Routed + 路由 + @@ -210,24 +232,32 @@ The following table summarizes the key characteristics of each feature module gr Feature Module + 特性模块 +

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; +

+ +

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

@@ -27,7 +31,11 @@ -

Bootstraps the app, using the root component from the specified NgModule.

+
+ +

Bootstraps the app, using the root component from the specified NgModule.

+ +

NgModule 中指定的根组件进行启动。

import { NgModule } from '@angular/core'; +

+ +

import { NgModule } from '@angular/core';

@@ -60,7 +70,11 @@ -

Defines a module that contains components, directives, pipes, and providers.

+
+ +

Defines a module that contains components, directives, pipes, and providers.

+ +

定义一个模块,其中可以包含组件、指令、管道和服务提供商。

List of components, directives, and pipes that belong to this module.

+
+ +

List of components, directives, and pipes that belong to this module.

+ +

属于当前模块的组件、指令和管道的列表。

List of modules to import into this module. Everything from the imported modules +

+ +

List of modules to import into this module. Everything from the imported modules is available to declarations of this module.

+

本模块所导入的模块列表

+

List of components, directives, and pipes visible to modules that import this module.

+
+ +

List of components, directives, and pipes visible to modules that import this module.

+ +

那些导入了本模块的模块所能看到的组件、指令和管道的列表

List of dependency injection providers visible both to the contents of this module and to importers of this module.

+
+ +

List of dependency injection providers visible both to the contents of this module and to importers of this module.

+ +

依赖注入提供商的列表,本模块以及本模块导入的所有模块中的内容都可以看见它们。

List of components to bootstrap when this module is bootstrapped.

+
+ +

List of components to bootstrap when this module is bootstrapped.

+ +

当本模块启动时,随之启动的组件列表。

Binds property value to the result of expression firstName.

+
+ +

Binds property value to the result of expression firstName.

+ +

value属性绑定到表达式firstName

Binds attribute role to the result of expression myAriaRole.

+
+ +

Binds attribute role to the result of expression myAriaRole.

+ +

把属性(Attribute)role绑定到表达式myAriaRole的结果。

Binds the presence of the CSS class extra-sparkle on the element to the truthiness of the expression isDelightful.

+
+ +

Binds the presence of the CSS class extra-sparkle on the element to the truthiness of the expression isDelightful.

+ +

根据isDelightful表达式的结果是否为真,决定CSS类extra-sparkle是否出现在当前元素上。

Binds style property width to the result of expression mySize in pixels. Units are optional.

+
+ +

Binds style property width to the result of expression mySize in pixels. Units are optional.

+ +

把CSS样式属性width的px(像素)值绑定到表达式mySize的结果。单位是可选的。

Calls method readRainbow when a click event is triggered on this button element (or its children) and passes in the event object.

+
+ +

Calls method readRainbow when a click event is triggered on this button element (or its children) and passes in the event object.

+ +

当这个按钮元素(及其子元素)上的click事件触发时,调用方法readRainbow,并把这个事件对象作为参数传进去。

Binds a property to an interpolated string, for example, "Hello Seabiscuit". Equivalent to: +

+ +

Binds a property to an interpolated string, for example, "Hello Seabiscuit". Equivalent to: <div [title]="'Hello ' + ponyName">

+

把一个属性绑定到插值字符串(如"Hello Seabiscuit")。这种写法等价于<div [title]="'Hello ' + ponyName">

+

Binds text content to an interpolated string, for example, "Hello Seabiscuit".

+
+ +

Binds text content to an interpolated string, for example, "Hello Seabiscuit".

+ +

把文本内容绑定到插值字符串(如"Hello Seabiscuit")

Sets up two-way data binding. Equivalent to: <my-cmp [title]="name" (titleChange)="name=$event">

+
+ +

Sets up two-way data binding. Equivalent to: <my-cmp [title]="name" (titleChange)="name=$event">

+ +

设置双向绑定。等价于<my-cmp [title]="name" (titleChange)="name=$event">

Creates a local variable movieplayer that provides access to the video element instance in data-binding and event-binding expressions in the current template.

+
+ +

Creates a local variable movieplayer that provides access to the video element instance in data-binding and event-binding expressions in the current template.

+ +

创建一个局部变量movieplayer,支持在当前模板的数据绑定和事件绑定表达式中访问video元素的实例。

The * symbol turns the current element into an embedded template. Equivalent to: +

+ +

The * symbol turns the current element into an embedded template. Equivalent to: <ng-template [myUnless]="myExpression"><p>...</p></ng-template>

Transforms the current value of expression cardNumber via the pipe called myCardNumberFormatter.

+
+ +

Transforms the current value of expression cardNumber via the pipe called myCardNumberFormatter.

+ +

使用名叫myCardNumberFormatter的管道对表达式cardNumber的当前值进行变幻

The safe navigation operator (?) means that the employer field is optional and if undefined, the rest of the expression should be ignored.

+
+ +

The safe navigation operator (?) means that the employer field is optional and if undefined, the rest of the expression should be ignored.

+ +

安全导航操作符(?)表示employer字段是可选的,如果它是 undefined ,那么表达式其余的部分就会被忽略,并返回 undefined

An SVG snippet template needs an svg: prefix on its root element to disambiguate the SVG element from an HTML component.

+
+ +

An SVG snippet template needs an svg: prefix on its root element to disambiguate the SVG element from an HTML component.

+ +

模板中的 SVG 片段需要给它的根元素加上svg:前缀,以便把 SVG 元素和 HTML 元素区分开。

An <svg> root element is detected as an SVG element automatically, without the prefix.

+
+ +

An <svg> root element is detected as an SVG element automatically, without the prefix.

+ +

<svg>作为根元素时会自动识别为 SVG 元素,不需要前缀。

import { CommonModule } from '@angular/common'; +

+ +

import { CommonModule } from '@angular/common';

@@ -345,7 +435,11 @@ is available to declarations of this module.

-

Removes or recreates a portion of the DOM tree based on the showSection expression.

+
+ +

Removes or recreates a portion of the DOM tree based on the showSection expression.

+ +

根据showSection表达式的结果,移除或重新创建 DOM 树的一部分。

Turns the li element and its contents into a template, and uses that to instantiate a view for each item in list.

+
+ +

Turns the li element and its contents into a template, and uses that to instantiate a view for each item in list.

+ +

把li元素及其内容变成一个模板,并使用这个模板为列表中的每一个条目实例化一个视图。

Conditionally swaps the contents of the div by selecting one of the embedded templates based on the current value of conditionExpression.

+
+ +

Conditionally swaps the contents of the div by selecting one of the embedded templates based on the current value of conditionExpression.

+ +

根据conditionExpression的当前值选择一个嵌入式模板,并用它替换这个 div 的内容。

Binds the presence of CSS classes on the element to the truthiness of the associated map values. The right-hand expression should return {class-name: true/false} map.

+
+ +

Binds the presence of CSS classes on the element to the truthiness of the associated map values. The right-hand expression should return {class-name: true/false} map.

+ +

根据 map 中的 value 是否为真,来决定该元素上是否出现与 name 对应的 CSS 类。右侧的表达式应该返回一个形如 {class-name: true/false} 的 map。

Allows you to assign styles to an HTML element using CSS. You can use CSS directly, as in the first example, or you can call a method from the component.

+
+ +

Allows you to assign styles to an HTML element using CSS. You can use CSS directly, as in the first example, or you can call a method from the component.

import { FormsModule } from '@angular/forms'; +

+ +

import { FormsModule } from '@angular/forms';

@@ -428,7 +538,11 @@ is available to declarations of this module.

-

Provides two-way data-binding, parsing, and validation for form controls.

+
+ +

Provides two-way data-binding, parsing, and validation for form controls.

+ +

为表单控件提供双向数据绑定、解析和验证功能。

import { Directive, ... } from '@angular/core'; +

+ +

import { Directive, ... } from '@angular/core';

@@ -461,7 +577,11 @@ is available to declarations of this module.

-

Declares that a class is a component and provides metadata about the component.

+
+ +

Declares that a class is a component and provides metadata about the component.

+ +

声明一个类是组件,并提供该组件的元数据。

Declares that a class is a directive and provides metadata about the directive.

+
+ +

Declares that a class is a directive and provides metadata about the directive.

+ +

声明一个类是指令,并提供该指令的元数据。

Declares that a class is a pipe and provides metadata about the pipe.

+
+ +

Declares that a class is a pipe and provides metadata about the pipe.

+ +

声明一个类是管道,并提供该管道的元数据。

Declares that a class has dependencies that should be injected into the constructor when the dependency injector is creating an instance of this class. +

+ +

Declares that a class has dependencies that should be injected into the constructor when the dependency injector is creating an instance of this class.

@@ -516,7 +646,9 @@ is available to declarations of this module.

-

@Directive({ property1: value1, ... }) +

+ +

@Directive({ property1: value1, ... })

@@ -532,11 +664,17 @@ is available to declarations of this module.

-

Specifies a CSS selector that identifies this directive within a template. Supported selectors include element, +

+ +

Specifies a CSS selector that identifies this directive within a template. Supported selectors include element, [attribute], .class, and :not().

+

指定一个 CSS 选择器,用于在模板中标记出该指令。支持的选择器类型包括:元素名[属性名], .类名:not()

+

Does not support parent-child relationship selectors.

+

但不支持指定父子关系的选择器。

+

List of dependency injection providers for this directive and its children.

+
+ +

List of dependency injection providers for this directive and its children.

+ +

该指令及其子指令的依赖注入提供商列表。

+

+ +

+ @Component extends @Directive, so the @Directive configuration applies to components as well

@@ -580,7 +725,11 @@ so the @Directive configuration applies to components as well

-

If set, the templateUrl and styleUrl are resolved relative to the component.

+
+ +

If set, the templateUrl and styleUrl are resolved relative to the component.

+ +

如果设置了,那么 templateUrlstyleUrl 的路径就会相对于当前组件进行解析。

List of dependency injection providers scoped to this component's view.

+
+ +

List of dependency injection providers scoped to this component's view.

+ +

依赖注入提供商列表,但它们的范围被限定为当前组件的视图。

Inline template or external template URL of the component's view.

+
+ +

Inline template or external template URL of the component's view.

+ +

当前组件视图的内联模板或外部模板的 URL 。

List of inline CSS styles or external stylesheet URLs for styling the component’s view.

+
+ +

List of inline CSS styles or external stylesheet URLs for styling the component’s view.

+ +

用于为当前组件的视图提供样式的内联 CSS 或外部样式表 URL 的列表。

import { Input, ... } from '@angular/core'; +

+ +

import { Input, ... } from '@angular/core';

@@ -649,9 +812,13 @@ so the @Directive configuration applies to components as well

-

Declares an input property that you can update via property binding (example: +

+ +

Declares an input property that you can update via property binding (example: <my-cmp [myProperty]="someExpression">).

+

声明一个输入属性,你可以通过属性绑定来更新它,如 <my-cmp [myProperty]="someExpression">

+

Declares an output property that fires events that you can subscribe to with an event binding (example: <my-cmp (myEvent)="doSomething()">).

+
+ +

Declares an output property that fires events that you can subscribe to with an event binding (example: <my-cmp (myEvent)="doSomething()">).

+ +

声明一个输出属性,它发出事件,你可以用事件绑定来订阅它们(如:<my-cmp (myEvent)="doSomething()">)。

Binds a host element property (here, the CSS class valid) to a directive/component property (isValid).

+
+ +

Binds a host element property (here, the CSS class valid) to a directive/component property (isValid).

+ +

把宿主元素的一个属性(这里是 CSS 类 valid)绑定到指令或组件上的 isValid 属性。

Subscribes to a host element event (click) with a directive/component method (onClick), optionally passing an argument ($event).

+
+ +

Subscribes to a host element event (click) with a directive/component method (onClick), optionally passing an argument ($event).

+ +

用指令或组件上的onClick方法订阅宿主元素上的click事件,并从中获取$event参数(可选)

Binds the first result of the component content query (myPredicate) to a property (myChildComponent) of the class.

+
+ +

Binds the first result of the component content query (myPredicate) to a property (myChildComponent) of the class.

+ +

把组件内容查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。

Binds the results of the component content query (myPredicate) to a property (myChildComponents) of the class.

+
+ +

Binds the results of the component content query (myPredicate) to a property (myChildComponents) of the class.

+ +

把组件内容查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上

Binds the first result of the component view query (myPredicate) to a property (myChildComponent) of the class. Not available for directives.

+
+ +

Binds the first result of the component view query (myPredicate) to a property (myChildComponent) of the class. Not available for directives.

+ +

把组件视图查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。对指令无效。

Binds the results of the component view query (myPredicate) to a property (myChildComponents) of the class. Not available for directives.

+
+ +

Binds the results of the component view query (myPredicate) to a property (myChildComponents) of the class. Not available for directives.

+ +

把组件视图查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上。对指令无效。

(implemented as class methods) +

+ +

(implemented as class methods)

@@ -767,7 +964,11 @@ so the @Directive configuration applies to components as well

-

Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here.

+
+ +

Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here.

+ +

在任何其它生命周期钩子之前调用。可以用它来注入依赖项,但不要在这里做正事。

Called after every change to input properties and before processing content or child views.

+
+ +

Called after every change to input properties and before processing content or child views.

+ +

每当输入属性发生变化时就会调用,但位于处理内容(ng-content)或子视图之前。

Called after the constructor, initializing input properties, and the first call to ngOnChanges.

+
+ +

Called after the constructor, initializing input properties, and the first call to ngOnChanges.

+ +

在调用完构造函数、初始化完所有输入属性并首次调用过ngOnChanges之后调用。

Called every time that the input properties of a component or a directive are checked. Use it to extend change detection by performing a custom check.

+
+ +

Called every time that the input properties of a component or a directive are checked. Use it to extend change detection by performing a custom check.

+ +

每当对组件或指令的输入属性进行变更检测时就会调用。可以用它来扩展变更检测逻辑,执行自定义的检测逻辑。

Called after ngOnInit when the component's or directive's content has been initialized.

+
+ +

Called after ngOnInit when the component's or directive's content has been initialized.

+ +

ngOnInit完成之后,当组件或指令的内容(ng-content)已经初始化完毕时调用。

Called after every check of the component's or directive's content.

+
+ +

Called after every check of the component's or directive's content.

+ +

每当组件或指令的内容(ng-content)做变更检测时调用。

Called after ngAfterContentInit when the component's view has been initialized. Applies to components only.

+
+ +

Called after ngAfterContentInit when the component's view has been initialized. Applies to components only.

+ +

ngAfterContentInit完毕,并且组件的视图已经初始化完毕时调用。只适用于组件。

Called after every check of the component's view. Applies to components only.

+
+ +

Called after every check of the component's view. Applies to components only.

+ +

当组件视图每次执行变更检测时调用。只适用于组件。

Called once, before the instance is destroyed.

+
+ +

Called once, before the instance is destroyed.

+ +

只在实例被销毁前调用一次。

Sets or overrides the provider for MyService to the MyMockService class.

+
+ +

Sets or overrides the provider for MyService to the MyMockService class.

+ +

MyService 的服务提供商设置或改写为 MyMockService 类。

Sets or overrides the provider for MyService to the myFactory factory function.

+
+ +

Sets or overrides the provider for MyService to the myFactory factory function.

+ +

MyService 的服务提供商设置或改写为 myFactory 工厂函数。

Sets or overrides the provider for MyValue to the value 41.

+
+ +

Sets or overrides the provider for MyValue to the value 41.

+ +

MyValue 的服务提供商改写为一个特定的值 41

import { Routes, RouterModule, ... } from '@angular/router'; +

+ +

import { Routes, RouterModule, ... } from '@angular/router';

@@ -951,7 +1198,11 @@ so the @Directive configuration applies to components as well

-

Configures routes for the application. Supports static, parameterized, redirect, and wildcard routes. Also supports custom route data and resolve.

+
+ +

Configures routes for the application. Supports static, parameterized, redirect, and wildcard routes. Also supports custom route data and resolve.

+ +

为该应用配置路由。支持静态、参数化、重定向和通配符路由。也支持自定义路由数据和解析(resolve)函数。

Marks the location to load the component of the active route.

+
+ +

Marks the location to load the component of the active route.

+ +

标记出一个位置,用来加载活动路由的组件。

Creates a link to a different view based on a route instruction consisting of a route path, required and optional parameters, query parameters, and a fragment. To navigate to a root route, use the / prefix; for a child route, use the ./prefix; for a sibling or parent, use the ../ prefix.

+
+ +

Creates a link to a different view based on a route instruction consisting of a route path, required and optional parameters, query parameters, and a fragment. To navigate to a root route, use the / prefix; for a child route, use the ./prefix; for a sibling or parent, use the ../ prefix.

+ +

使用路由体系创建一个到其它视图的链接。路由体系由路由路径、必要参数、可选参数、查询参数和文档片段组成。要导航到根路由,请使用/前缀;要导航到子路由,使用./前缀;要导航到兄弟路由或父级路由,使用../前缀。

The provided classes are added to the element when the routerLink becomes the current active route.

+
+ +

The provided classes are added to the element when the routerLink becomes the current active route.

+ +

routerLink 指向的路由变成活动路由时,为当前元素添加一些类(比如这里的 active)。

An interface for defining a class that the router should call first to determine if it should activate this component. Should return a boolean or an Observable/Promise that resolves to a boolean.

+
+ +

An interface for defining a class that the router should call first to determine if it should activate this component. Should return a boolean or an Observable/Promise that resolves to a boolean.

+ +

用来定义类的接口。路由器会首先调用本接口来决定是否激活该路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

An interface for defining a class that the router should call first to determine if it should deactivate this component after a navigation. Should return a boolean or an Observable/Promise that resolves to a boolean.

+
+ +

An interface for defining a class that the router should call first to determine if it should deactivate this component after a navigation. Should return a boolean or an Observable/Promise that resolves to a boolean.

+ +

用来定义类的接口。路由器会在导航离开前首先调用本接口以决定是否取消激活本路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

An interface for defining a class that the router should call first to determine if it should activate the child route. Should return a boolean or an Observable/Promise that resolves to a boolean.

+
+ +

An interface for defining a class that the router should call first to determine if it should activate the child route. Should return a boolean or an Observable/Promise that resolves to a boolean.

+ +

用来定义类的接口。路由器会首先调用本接口来决定是否激活一个子路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise

An interface for defining a class that the router should call first to resolve route data before rendering the route. Should return a value or an Observable/Promise that resolves to a value.

+
+ +

An interface for defining a class that the router should call first to resolve route data before rendering the route. Should return a value or an Observable/Promise that resolves to a value.

+ +

用来定义类的接口。路由器会在渲染该路由之前,首先调用它来解析路由数据。应该返回一个值或能解析成值的 Observable/Promise

An interface for defining a class that the router should call first to check if the lazy loaded module should be loaded. Should return a boolean or an Observable/Promise that resolves to a boolean.

+
+ +

An interface for defining a class that the router should call first to check if the lazy loaded module should be loaded. Should return a boolean or an Observable/Promise that resolves to a boolean.

+ +

用来定义类的接口。路由器会首先调用它来决定是否应该加载一个惰性加载模块。应该返回一个 boolean 或能解析成 booleanObservable/Promise

@@ -273,7 +275,7 @@ button.addEventListener(‘click’, handler); button.removeEventListener(‘click’, handler); -
Listen for keystrokes, but provide a stream representing the value in the input. + + + Listen for keystrokes, but provide a stream representing the value in the input.
fromEvent(inputEl, 'keydown').pipe(
   map(e => e.target.value)
 );
Does not support configuration. + + + Does not support configuration.
element.addEventListener(eventName, (event) => {
   // Cannot change the passed Event into another
   // value before it gets to the handler
diff --git a/aio/content/guide/component-interaction.md b/aio/content/guide/component-interaction.md
index a1e1d1bd8f..d20bd329cf 100644
--- a/aio/content/guide/component-interaction.md
+++ b/aio/content/guide/component-interaction.md
@@ -82,7 +82,7 @@ The running application displays three heroes:
 
 

Test it

-

测试一下

+

测试一下!

E2E test that all children were instantiated and displayed as expected: @@ -129,7 +129,7 @@ Here's the `NameParentComponent` demonstrating name variations including a name

Test it

-

测试一下

+

测试一下!

E2E tests of input property setter with empty and non-empty names: @@ -191,7 +191,7 @@ Here's the output of a button-pushing sequence:

Test it

-

测试一下

+

测试一下!

Test that ***both*** input properties are set initially and that button clicks trigger the expected `ngOnChanges` calls and values: @@ -251,7 +251,7 @@ and the method processes it:

Test it

-

测试一下

+

测试一下!

Test that clicking the *Agree* and *Disagree* buttons update the appropriate counters: @@ -325,7 +325,7 @@ Here we see the parent and child working together.

Test it

-

测试一下

+

测试一下!

Test that the seconds displayed in the parent template match the seconds displayed in the child's status message. @@ -431,7 +431,7 @@ that it takes future values from the timer component.

Test it

-

测试一下

+

测试一下!

Use [the same countdown timer tests](guide/component-interaction#countdown-tests) as before. @@ -512,7 +512,7 @@ facilitated by the service:

Test it

-

测试一下

+

测试一下!

Tests click buttons of both the parent `MissionControlComponent` and the `AstronautComponent` children and verify that the history meets expectations: diff --git a/aio/content/guide/dependency-injection-in-action.md b/aio/content/guide/dependency-injection-in-action.md index df03b4e0c3..7aefee41a3 100644 --- a/aio/content/guide/dependency-injection-in-action.md +++ b/aio/content/guide/dependency-injection-in-action.md @@ -12,7 +12,7 @@ This cookbook explores many of the features of Dependency Injection (DI) in Angu See the of the code in this cookbook. -到查看本烹饪书的源码。 +要获取本“烹饪宝典”的代码,**参见**。 {@a app-wide-dependencies} diff --git a/aio/content/guide/docs-style-guide.md b/aio/content/guide/docs-style-guide.md index ea75074899..a4a8a3cb87 100644 --- a/aio/content/guide/docs-style-guide.md +++ b/aio/content/guide/docs-style-guide.md @@ -124,11 +124,7 @@ All section heading text should be in "Sentence case", which means the first wor **Always follow the section heading with at least one blank line.** -

- -Main section heading - -

+

Main section heading

There are usually one or more main sections that may be further divided into secondary sections. @@ -144,11 +140,7 @@ The main section heading should be followed by a blank line and then the content ``` -

- -Secondary section heading - -

+

Secondary section heading

A secondary section heading is related to a main heading and _falls textually within_ the bounds of that main heading. @@ -218,11 +210,7 @@ To exclude a heading from the TOC, create the heading as an `

` or `

` ele ```html -

- -This heading is not displayed in the TOC - -

+

This heading is not displayed in the TOC

``` @@ -230,11 +218,7 @@ You can turn off TOC generation for the _entire_ page by writing the title with ```html -

- -A guide without a TOC - -

+

A guide without a TOC

``` @@ -803,6 +787,8 @@ Remember to exclude these files from stackblitz by listing them in the `stackbli ## Live examples +## 在线例子 + By adding `` to the page you generate links that run sample code in the Stackblitz live coding environment and download that code to the reader's file system. Live examples (AKA "stackblitz") are defined by one or more `stackblitz.json` files in the root of a code sample folder. Each sample folder usually has a single unnamed definition file, the default `stackblitz.json`. @@ -1309,6 +1295,8 @@ Use HTML tables to present tabular data. Routing + 路由 +
@@ -1331,6 +1319,8 @@ Use HTML tables to present tabular data. Routing + 路由 + @@ -1411,6 +1403,8 @@ Here is the markup for this table. Routing + 路由 + @@ -1433,6 +1427,8 @@ Here is the markup for this table. Routing + 路由 + diff --git a/aio/content/guide/glossary.md b/aio/content/guide/glossary.md index da80ff9b64..30dbbf17ac 100644 --- a/aio/content/guide/glossary.md +++ b/aio/content/guide/glossary.md @@ -782,6 +782,8 @@ You rarely access Angular feature modules directly. You usually import them from ## NgModule +## 可观察对象 (observable) + Helps you organize an application into cohesive blocks of functionality. An NgModule identifies the components, directives, and pipes that the application uses along with the list of external NgModules that the application needs, such as `FormsModule`. @@ -957,7 +959,7 @@ For more information, see the [Routing & Navigation](guide/router) page. ## Router module -## 路由器模块 +## 路由器模块 (router module) A separate [NgModule](guide/glossary#ngmodule) that provides the necessary service providers and directives for navigating through application views. diff --git a/aio/content/guide/http.md b/aio/content/guide/http.md index 4e4ea82e3c..33ce583ac3 100644 --- a/aio/content/guide/http.md +++ b/aio/content/guide/http.md @@ -450,9 +450,6 @@ You can think of these observables as _blueprints_ for actual HTTP requests. In fact, each `subscribe()` initiates a separate, independent execution of the observable. Subscribing twice results in two HTTP requests. -*注意这个`subscribe()`方法*。 所有从`HttpClient`返回的可观察对象都是*冷的(cold)*,也就是说,它们只是发起请求的*蓝图*而已。在我们调用`subscribe()`之前,什么都不会发生,而当我们每次调用`subscribe()`时,就会独立发起一次请求。 -比如,下列代码会使用同样的数据发送两次同样的 POST 请求: - ```javascript const req = http.get('/api/heroes'); @@ -483,6 +480,8 @@ in order to initiate the request. ## Advanced usage +## 高级用法 + The above sections detail how to use the basic HTTP functionality in `@angular/common/http`, but sometimes you need to do more than make simple requests and get data back. ### Configuring the request @@ -793,8 +792,6 @@ If you set the cloned request body to `undefined`, Angular assumes you intend to That is not what you want. If you set the cloned request body to `null`, Angular knows you intend to clear the request body. -这种克隆一个请求并设置一组新的请求头的操作非常常见,因此有了一种快捷写法: - ```javascript newReq = req.clone({ ... }); // body not mentioned => preserve original body @@ -963,8 +960,6 @@ the cached response first (and immediately), followed later by the response from the server. Subscribers see a sequence of _two_ responses. -现在,如果 URL 被缓存过,那么任何人调用`http.get(url)`时都会收到*两次*响应。 - ### Listening to progress events ### 监听进度事件 @@ -1105,7 +1100,7 @@ There are also tests of an application data service that call `HttpClient` in ### Setup -### 初始设置 +### 环境设置 To begin testing calls to `HttpClient`, import the `HttpClientTestingModule` and the mocking controller, `HttpTestingController`, @@ -1150,6 +1145,8 @@ Now you can write a test that expects a GET Request to occur and provides a mock The last step, verifying that no requests remain outstanding, is common enough for you to move it into an `afterEach()` step: +最后一步,验证没有发起过预期之外的请求,足够通用,因此我们可以把它移到`afterEach()`中: + diff --git a/aio/content/guide/module-types.md b/aio/content/guide/module-types.md index 9e9f2012cd..50646029be 100644 --- a/aio/content/guide/module-types.md +++ b/aio/content/guide/module-types.md @@ -38,12 +38,16 @@ typical characteristics, in real world apps, you may see hybrids. Feature Module + 特性模块 + Guidelines + 指导原则 +
@@ -70,6 +76,8 @@ typical characteristics, in real world apps, you may see hybrids. They might be imported by the root `AppModule` of a small application that lacks routing. + 对于缺少路由的小型应用,它们可能只会被根模块`AppModule`导入一次。 +
@@ -88,6 +98,8 @@ typical characteristics, in real world apps, you may see hybrids. All lazy-loaded modules are routed feature modules by definition. + 根据这个定义,所有惰性加载的模块都是路由特性模块。 + Routed feature modules don’t export anything because their components never appear in the template of an external component. A lazy-loaded routed feature module should not be imported by any module. Doing so would trigger an eager load, defeating the purpose of lazy loading.That means you won’t see them mentioned among the `AppModule` imports. An eager loaded routed feature module must be imported by another module so that the compiler learns about its components. @@ -104,6 +116,8 @@ typical characteristics, in real world apps, you may see hybrids. Routing + 路由 + @@ -112,6 +126,8 @@ typical characteristics, in real world apps, you may see hybrids. A routing module typically does the following: + 路由模块通常会做这些: +
  • @@ -164,6 +180,8 @@ typical characteristics, in real world apps, you may see hybrids. Service + 服务 +
@@ -182,6 +200,8 @@ typical characteristics, in real world apps, you may see hybrids. Widget + 窗口部件 + @@ -194,6 +214,8 @@ typical characteristics, in real world apps, you may see hybrids. Import widget modules in any module whose component templates need the widgets. + 如果任何模块的组件模板中需要用到这些窗口部件,就请导入相应的窗口部件模块。 +
Declarations + 声明`declarations` + Providers + 提供商`providers` + Exports + 导出什么 + @@ -244,24 +274,32 @@ The following table summarizes the key characteristics of each feature module gr Domain + 领域 + Yes + 有 + Rare + 罕见 + Top component + 顶级组件 + @@ -278,24 +316,32 @@ The following table summarizes the key characteristics of each feature module gr Routed + 路由 + Yes + 有 + Rare + 罕见 + No + 无 + @@ -312,12 +358,16 @@ The following table summarizes the key characteristics of each feature module gr Routing + 路由 + No + 无 + @@ -346,24 +396,32 @@ The following table summarizes the key characteristics of each feature module gr Service + 服务 + No + 无 + Yes + 有 + No + 无 + @@ -380,24 +438,32 @@ The following table summarizes the key characteristics of each feature module gr Widget + 窗口部件 + Yes + 有 + Rare + 罕见 + Yes + 有 + diff --git a/aio/content/guide/ngmodule-api.md b/aio/content/guide/ngmodule-api.md index 4dbb596da6..f25f78a127 100644 --- a/aio/content/guide/ngmodule-api.md +++ b/aio/content/guide/ngmodule-api.md @@ -46,6 +46,8 @@ into three categories: The following table summarizes the `@NgModule` metadata properties. +下面是`@NgModule`元数据中属性的汇总表: + @@ -62,7 +64,7 @@ The following table summarizes the `@NgModule` metadata properties. Description - 描述 + 说明 @@ -130,6 +132,8 @@ The following table summarizes the `@NgModule` metadata properties. A list of dependency-injection providers. + 依赖注入提供商的列表。 + Angular registers these providers with the NgModule's injector. If it is the NgModule used for bootstrapping then it is the root injector. @@ -231,9 +235,13 @@ The following table summarizes the `@NgModule` metadata properties. Usually there's only one component in this list, the _root component_ of the application. + 通常,在这个列表中只有一个组件,也就是应用的*根组件*。 + Angular can launch with multiple bootstrap components, each with its own location in the host web page. + Angular也可以引导多个引导组件,它们每一个都在宿主页面中有自己的位置。 + A bootstrap component is automatically added to `entryComponents`. diff --git a/aio/content/guide/ngmodule-faq.md b/aio/content/guide/ngmodule-faq.md index 6f8ebd3ad2..4ed06c07a2 100644 --- a/aio/content/guide/ngmodule-faq.md +++ b/aio/content/guide/ngmodule-faq.md @@ -913,7 +913,7 @@ For more information, see [Entry Components](guide/entry-components). ## Why does Angular need _entryComponents_? -## 为什么 Angular 需要*入口组件*? +## 为什么Angular需要*入口组件*? The reason is _tree shaking_. For production apps you want to load the smallest, fastest code possible. The code should contain only the classes that you actually need. It should exclude a component that's never used, whether or not that component is declared. diff --git a/aio/content/guide/ngmodule-vs-jsmodule.md b/aio/content/guide/ngmodule-vs-jsmodule.md index 6417ed7492..78deb5847b 100644 --- a/aio/content/guide/ngmodule-vs-jsmodule.md +++ b/aio/content/guide/ngmodule-vs-jsmodule.md @@ -65,6 +65,8 @@ The NgModule classes differ from JavaScript module in the following key ways: * An NgModule bounds [declarable classes](guide/ngmodule-faq#q-declarable) only. Declarables are the only classes that matter to the [Angular compiler](guide/ngmodule-faq#q-angular-compiler). + Angular模块只绑定了[_可声明的类_](guide/ngmodule-faq#q-declarable),这些可声明的类只是供[Angular编译器](guide/ngmodule-faq#q-angular-compiler)用的。 + * Instead of defining all member classes in one giant file as in a JavaScript module, you list the module's classes in the `@NgModule.declarations` list. diff --git a/aio/content/guide/ngmodules.md b/aio/content/guide/ngmodules.md index 8483e5b3be..f7c3c2b166 100644 --- a/aio/content/guide/ngmodules.md +++ b/aio/content/guide/ngmodules.md @@ -1,5 +1,7 @@ # NgModules +# Angular模块 (NgModule) + #### Prerequisites A basic understanding of the following concepts: @@ -26,6 +28,8 @@ section. ## Angular modularity +## Angular 模块化 + Modules are a great way to organize an application and extend it with capabilities from external libraries. Angular libraries are NgModules, such as `FormsModule`, `HttpClientModule`, and `RouterModule`. @@ -38,6 +42,8 @@ NgModules consolidate components, directives, and pipes into cohesive blocks of functionality, each focused on a feature area, application business domain, workflow, or common collection of utilities. +Angular 模块把组件、指令和管道打包成内聚的功能块,每个模块聚焦于一个特性区域、业务领域、工作流或通用工具。 + Modules can also add services to the application. Such services might be internally developed, like something you'd develop yourself or come from outside sources, such as the Angular router and HTTP client. diff --git a/aio/content/guide/pipes.md b/aio/content/guide/pipes.md index b23ea9d495..42e1d86bfe 100644 --- a/aio/content/guide/pipes.md +++ b/aio/content/guide/pipes.md @@ -582,7 +582,7 @@ display updates as you add heroes, even when you mutate the `heroes` array.

The impure AsyncPipe

-

非纯管道 AsyncPipe

+

非纯 AsyncPipe

The Angular `AsyncPipe` is an interesting example of an impure pipe. The `AsyncPipe` accepts a `Promise` or `Observable` as input diff --git a/aio/content/guide/quickstart.md b/aio/content/guide/quickstart.md index 35bdfa1433..0a429f64a4 100644 --- a/aio/content/guide/quickstart.md +++ b/aio/content/guide/quickstart.md @@ -29,13 +29,9 @@ And you can also 下载这个例子。 -

+

Step 1. Set up the Development Environment

- Step 1. Set up the Development Environment - - 步骤1. 设置开发环境 - - +

步骤1. 设置开发环境

You need to set up your development environment before you can do anything. @@ -68,13 +64,9 @@ Then **install the [Angular CLI](https://github.com/angular/angular-cli)** globa -

+

Step 2. Create a new project

- Step 2. Create a new project - - 步骤2. 创建新项目 - - +

步骤2. 创建新项目

Open a terminal window. @@ -100,13 +92,9 @@ It takes time to set up a new project; most of it is spent installing npm packag -

+

Step 3: Serve the application

- Step 3: Serve the application - - 步骤3. 启动开发服务器 - - +

步骤3. 启动开发服务器

Go to the project directory and launch the server. @@ -137,13 +125,9 @@ Your app greets you with a message: The app works! -

+

Step 4: Edit your first Angular component

- Step 4: Edit your first Angular component - - 步骤4. 编辑我们的第一个Angular组件 - - +

步骤4. 编辑我们的第一个Angular组件

The CLI created the first Angular component for you. This is the _root component_ and it is named `app-root`. @@ -641,7 +625,7 @@ These files go in the root folder next to `src/`. Purpose - 用途 + 目的 diff --git a/aio/content/guide/reactive-forms.md b/aio/content/guide/reactive-forms.md index 1e69790d1c..e09746a3e3 100644 --- a/aio/content/guide/reactive-forms.md +++ b/aio/content/guide/reactive-forms.md @@ -924,7 +924,7 @@ such as one of the following: Description - 描述 + 说明 @@ -998,8 +998,8 @@ such as one of the following: `true` if the control user has not yet entered the HTML control and triggered its blur event. Its opposite is `myControl.touched`. - - 如果用户尚未进入这个HTML控件,也没有触发过它的`blur`(失去焦点)事件,则为`true`。 + + 如果用户尚未进入这个HTML控件,也没有触发过它的`blur`(失去焦点)事件,则为`true`。 它是`myControl.touched`的反义词。 diff --git a/aio/content/guide/router.md b/aio/content/guide/router.md index 87d50473fc..a83417db7b 100644 --- a/aio/content/guide/router.md +++ b/aio/content/guide/router.md @@ -309,7 +309,7 @@ It has a great deal of useful information including: Description - 描述 + 说明 @@ -538,7 +538,7 @@ During each navigation, the `Router` emits navigation events through the `Router Description - 描述 + 说明 @@ -725,7 +725,7 @@ Here are the key `Router` terms and their meanings: Router - 路由器 + Router(路由器) @@ -746,6 +746,8 @@ Here are the key `Router` terms and their meanings: RouterModule + RouterModule(路由器模块) + @@ -785,7 +787,7 @@ Here are the key `Router` terms and their meanings: Route - 路由器 + Route(路由) @@ -806,6 +808,8 @@ Here are the key `Router` terms and their meanings: RouterOutlet + RouterOutlet(路由出口) +
@@ -765,7 +767,7 @@ Here are the key `Router` terms and their meanings: Routes - 路由定义(数组) + Routes(路由数组) @@ -824,6 +828,8 @@ Here are the key `Router` terms and their meanings: RouterLink + RouterLink(路由链接) + @@ -842,6 +848,8 @@ Here are the key `Router` terms and their meanings: RouterLinkActive + RouterLinkActive(活动路由链接) + @@ -861,6 +869,8 @@ Here are the key `Router` terms and their meanings: ActivatedRoute + ActivatedRoute(激活的路由) + @@ -880,6 +890,8 @@ Here are the key `Router` terms and their meanings: RouterState + RouterState(路由器状态) + @@ -2507,7 +2519,7 @@ to handle parameter access for both route parameters (`paramMap`) and query para Description - 描述 + 说明 diff --git a/aio/content/guide/security.md b/aio/content/guide/security.md index 3b34509e47..24999808b2 100644 --- a/aio/content/guide/security.md +++ b/aio/content/guide/security.md @@ -17,13 +17,9 @@ You can run the in Stackblitz and download the cod 运行来试用本页的代码。 -

+

Reporting vulnerabilities

- Reporting vulnerabilities - - 举报漏洞 - - +

举报漏洞

To report vulnerabilities in Angular itself, email us at [security@angular.io](mailto:security@angular.io). @@ -34,13 +30,9 @@ philosophy](https://www.google.com/about/appsecurity/). 要了解关于“谷歌如何处理安全问题”的更多信息,参见[谷歌的安全哲学](https://www.google.com/about/appsecurity/)。 -

+

Best practices

- Best practices - - 最佳实践 - - +

最佳实践

* **Keep current with the latest Angular library releases.** We regularly update the Angular libraries, and these updates may fix security defects discovered in @@ -64,13 +56,9 @@ For more information, see the [Trusting safe values](guide/security#bypass-secur **避免使用本文档中带“[_安全风险_](guide/security#bypass-security-apis)”标记的Angular API。** 要了解更多信息,请参阅本章的[信任那些安全的值](guide/security#bypass-security-apis)部分。 -

+

Preventing cross-site scripting (XSS)

- Preventing cross-site scripting (XSS) - - 防范跨站脚本(XSS)攻击 - - +

防范跨站脚本(XSS)攻击

[Cross-site scripting (XSS)](https://en.wikipedia.org/wiki/Cross-site_scripting) enables attackers to inject malicious code into web pages. Such code can then, for example, steal user data (in @@ -247,13 +235,9 @@ carries a high risk of introducing template-injection vulnerabilities. 务必使用一个能够自动进行无害化处理以防范XSS漏洞的后端模板语言。不要在服务器端使用模板语言生成Angular模板, 这样会带来很高的“模板注入”风险。 -

+

Trusting safe values

- Trusting safe values - - 信任安全值 - - +

信任安全值

Sometimes applications genuinely need to include executable code, display an `