diff --git a/aio/content/guide/architecture.md b/aio/content/guide/architecture.md index 937e1d868b..5d16cf31db 100644 --- a/aio/content/guide/architecture.md +++ b/aio/content/guide/architecture.md @@ -184,6 +184,7 @@ JavaScript 中,每个_文件_是一个模块,文件中定义的所有对象 Learn more about the JavaScript module system on the web. + 学习更多关于 JavaScript 模块的知识。 @@ -245,6 +246,7 @@ Hang in there. The confusion yields to clarity with time and experience. Learn more from the [NgModules](guide/ngmodules) page. + 更多信息,见 [Angular 模块](guide/ngmodule)。 diff --git a/aio/content/guide/npm-packages.md b/aio/content/guide/npm-packages.md index 9a008baf2e..973127a0ea 100644 --- a/aio/content/guide/npm-packages.md +++ b/aio/content/guide/npm-packages.md @@ -19,6 +19,7 @@ The Angular CLI uses `yarn` by default to install npm packages when you create a
Node.js and npm are essential to Angular development. + Node.js和npm是做Angular开发的基础。 [Get them now](https://docs.npmjs.com/getting-started/installing-node "Installing Node.js and updating npm") diff --git a/aio/content/guide/reactive-forms.md b/aio/content/guide/reactive-forms.md index 3a5fcc31f5..f02ff06401 100644 --- a/aio/content/guide/reactive-forms.md +++ b/aio/content/guide/reactive-forms.md @@ -1148,8 +1148,10 @@ 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/tools/translator/checker.spec.ts b/aio/tools/translator/checker.spec.ts index 7ebccdefb4..6276791534 100644 --- a/aio/tools/translator/checker.spec.ts +++ b/aio/tools/translator/checker.spec.ts @@ -1,7 +1,16 @@ import { expect } from 'chai'; -import { DictEntry } from './dict-entry'; import { dirs } from './dirs'; -import { gatherFromMarkdownFiles, isTranslation } from './extractor'; +import { gatherFromMarkdownFiles } from './extractor'; +import { + isHead, + isNotCheatSheet, + isNotCnPages, + isNotImg, + isNotMarketingDocs, + originalIsNotChinese, + originalIsNotTag, + translationHasNotCodeExample, +} from './utils'; describe('自动检查翻译结果', function () { const entries = gatherFromMarkdownFiles(dirs.content) @@ -10,12 +19,12 @@ describe('自动检查翻译结果', function () { .filter(isNotCnPages); it('译文里不应该出现 ', function () { - const codeExamples = entries.filter(entry => entry.translation.indexOf(' isTranslation(entry.original)) + const lines = entries.filter(originalIsNotChinese) .filter(isNotImg); expect(lines).eql([]); }); @@ -33,27 +42,7 @@ describe('自动检查翻译结果', function () { }); it('原文不应该是以
/^ *", + "translation": "请参见下面[过滤器/管道](guide/ajs-quick-reference#filters-pipes)了解更多信息。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -146,7 +146,7 @@ }, { "original": "For more information, see the [ngFor micro-syntax](guide/template-syntax#microsyntax)\n section of the [Template Syntax](guide/template-syntax) page.", - "translation": "要了解更多信息,请参见[模板语法](guide/template-syntax)中的[ngFor微语法](guide/template-syntax#microsyntax)部分。\n ", + "translation": "要了解更多信息,请参见[模板语法](guide/template-syntax)中的[ngFor微语法](guide/template-syntax#microsyntax)部分。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -181,7 +181,7 @@ }, { "original": "For more information see the [Setup](guide/setup) page.", - "translation": "要了解更多,参见[搭建本地开发环境](guide/setup)。\n ", + "translation": "要了解更多,参见[搭建本地开发环境](guide/setup)。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -316,12 +316,12 @@ }, { "original": "In AngularJS, the `ng-href` is often used to activate a route as part of navigation.", - "translation": "在AngularJS 中,`ng-href`通常用来作为导航的一部分,激活一个路由。\n \n <a ng-href=\"#movies\">Movies</a>\n ", + "translation": "在AngularJS 中,`ng-href`通常用来作为导航的一部分,激活一个路由。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { "original": "Routing is handled differently in Angular.", - "translation": "路由在Angular中的处理方式不同。\n ", + "translation": "路由在Angular中的处理方式不同。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -356,7 +356,7 @@ }, { "original": "In this example, the `` element is removed from the DOM unless the `movies` array has a length greater than zero.", - "translation": "在这个例子中,除非`movies`数组的长度大于0,否则`
`元素就会被从DOM中移除。\n ", + "translation": "在这个例子中,除非`movies`数组的长度大于0,否则`
`元素就会被从DOM中移除。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -396,7 +396,7 @@ }, { "original": "In this example, the table row (``) element repeats for each movie object in the collection of movies.", - "translation": "在这个例子中,对`movies`集合中的每一个`movie`对象重复渲染了这个表格行元素(``)。\n ", + "translation": "在这个例子中,对`movies`集合中的每一个`movie`对象重复渲染了这个表格行元素(``)。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -411,7 +411,7 @@ }, { "original": "For more information, see [Structural Directives](guide/structural-directives).", - "translation": "要了解更多信息,参见[结构性指令](guide/structural-directives)。\n ", + "translation": "要了解更多信息,参见[结构性指令](guide/structural-directives)。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -421,7 +421,7 @@ }, { "original": "In this example, the `
` element is shown if the `favoriteHero` variable is truthy.", - "translation": "在这个例子中,如果`favoriteHero`变量为真,`
`元素就会显示出来。\n ", + "translation": "在这个例子中,如果`favoriteHero`变量为真,`
`元素就会显示出来。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -551,7 +551,7 @@ }, { "original": "The Angular `currency` pipe is similar although some of the parameters have changed.", - "translation": "Angular的`currency`管道和1中很相似,只是有些参数变化了。\n ", + "translation": "Angular的`currency`管道和1中很相似,只是有些参数变化了。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -569,16 +569,6 @@ "translation": "基于过滤条件从指定的集合中选取出一个子集。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, - { - "original": "
", + "translation": "Angular的`json`管道做完全相同的事。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { "original": "Selects up to the first parameter (2) number of items from the collection\n starting (optionally) at the beginning index (0).", - "translation": "从集合中选择从(第二参数指定的)起始索引号(0)开始的最多(第一参数指定的)条目数(2)个条目。\n ", + "translation": "从集合中选择从(第二参数指定的)起始索引号(0)开始的最多(第一参数指定的)条目数(2)个条目。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { "original": "The `SlicePipe` does the same thing but the *order of the parameters is reversed*, in keeping\n with the JavaScript `Slice` method.\n The first parameter is the starting index; the second is the limit.\n As in AngularJS, coding this operation within the component instead could improve performance.", - "translation": "`SlicePipe`做同样的事,但是*两个参数的顺序是相反的*,以便于JavaScript中的`slice`方法保持一致。\n 第一个参数是起始索引号,第二个参数是限制的数量。\n 和AngularJS中一样,如果们改用组件中的代码实现此操作,性能将会提升。\n ", + "translation": "`SlicePipe`做同样的事,但是*两个参数的顺序是相反的*,以便于JavaScript中的`slice`方法保持一致。\n 第一个参数是起始索引号,第二个参数是限制的数量。\n 和AngularJS中一样,如果们改用组件中的代码实现此操作,性能将会提升。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -606,7 +596,7 @@ }, { "original": "The Angular `lowercase` pipe does the same thing.", - "translation": "Angular的`lowercase`管道和1中的功能完全相同。\n ", + "translation": "Angular的`lowercase`管道和1中的功能完全相同。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -621,22 +611,12 @@ }, { "original": "Angular also has a `percent` pipe, which formats a number as a local percentage\n as shown in the third example.", - "translation": "Angular还有一个`percent`管道,它把一个数组格式化为本地化的(local)百分比格式,如第三个范例所示。\n ", + "translation": "Angular还有一个`percent`管道,它把一个数组格式化为本地化的(local)百分比格式,如第三个范例所示。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { "original": "Displays the collection in the order specified by the expression.\n In this example, the movie title orders the `movieList`.", - "translation": "使用表达式中所指定的方式对集合进行排序。\n 在这个例子中,`movieList`被根据movie的title排序了。\n ", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" - }, - { - "original": "", + "translation": "在AngularJS中,Angular模块用来对控制器、服务和其它代码进行跟踪。第二个参数定义该模块依赖的其它模块列表。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -709,11 +689,6 @@ "translation": "要了解关于模块的更多知识,参见[NgModules](guide/ngmodule)。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, - { - "original": "", + "translation": "在Angular1中,我们在控制器函数中写模型和方法的代码。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -771,7 +746,7 @@ }, { "original": "For more information, see the [Components](guide/architecture#components) \n section of the [Architecture Overview](guide/architecture) page.", - "translation": "要了解关于组件的更多信息,参见[架构概览](guide/architecture)中的[组件](guide/architecture#components)部分。\n ", + "translation": "要了解关于组件的更多信息,参见[架构概览](guide/architecture)中的[组件](guide/architecture#components)部分。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -801,7 +776,7 @@ }, { "original": "For more information, see the [Dependency injection](guide/architecture#dependency-injection) \n section of the [Architecture Overview](guide/architecture).", - "translation": "要了解关于依赖注入的更多信息,参见[架构概览](guide/architecture)中的[依赖注入](guide/architecture#dependency-injection)部分。\n ", + "translation": "要了解关于依赖注入的更多信息,参见[架构概览](guide/architecture)中的[依赖注入](guide/architecture#dependency-injection)部分。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -816,7 +791,7 @@ }, { "original": "AngularJS, uses a `link` tag in the head section of the `index.html` file\n to define the styles for the application.", - "translation": "在AngularJS中,我们在`index.html`的`head`区使用`link`标签来为应用程序定义样式。\n ", + "translation": "在AngularJS中,我们在`index.html`的`head`区使用`link`标签来为应用程序定义样式。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -849,11 +824,6 @@ "translation": "动画是现代Web应用设计中一个很重要的方面。我们希望用户界面能在不同的状态之间更平滑的转场。如果需要,还可以用适当的动画来吸引注意力。\n设计良好的动画不但会让UI更有趣,还会让它更容易使用。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/animations.md" }, - { - "original": "动画是现代Web应用设计中一个很重要的方面。我们希望用户界面能在不同的状态之间更平滑的转场。如果需要,还可以用适当的动画来吸引注意力。\n设计良好的动画不但会让UI更有趣,还会让它更容易使用。", - "translation": "## Overview\n## 概述", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/animations.md" - }, { "original": "Angular's animation system lets you build animations that run with the same kind of native\nperformance found in pure CSS animations. You can also tightly integrate your\nanimation logic with the rest of your application code, for ease of control.", "translation": "Angular的动画系统赋予了制作各种动画效果的能力,以构建出与原生CSS动画性能相同的动画。\n我们也获得了额外的让动画逻辑与其它应用代码紧紧集成在一起的能力,这让动画可以被更容易的触发与控制。", @@ -1249,11 +1219,6 @@ "translation": "其中一个动画组对元素的`transform`和`width`做动画,另一个组则对`opacity`做动画。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/animations.md" }, - { - "original": "其中一个动画组对元素的`transform`和`width`做动画,另一个组则对`opacity`做动画。", - "translation": "## Animation callbacks\n## 动画回调", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/animations.md" - }, { "original": "A callback is fired when an animation is started and also when it is done.", "translation": "当动画开始和结束时,会触发一个回调。", @@ -1479,11 +1444,6 @@ "translation": "如果你好奇,可以打开`aot/app.component.ngfactory.ts`来看看原始Angular模板语法被编译成TypeScript时的中间结果。JIT compilation generates these same _NgFactories_ in memory where they are largely invisible.\nAOT compilation reveals them as separate, physical files.", "sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md" }, - { - "original": "如果你好奇,可以打开`aot/app.component.ngfactory.ts`来看看原始Angular模板语法被编译成TypeScript时的中间结果。JIT compilation generates these same _NgFactories_ in memory where they are largely invisible.\nAOT compilation reveals them as separate, physical files.", - "translation": "JIT编译器在内存中同样会生成这一堆*NgFactory*,但它们大部分是不可见的。\nAOT编译器则会生成在单独的物理文件中。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md" - }, { "original": "Do not edit the _NgFactories_! Re-compilation replaces these files and all edits will be lost.", "translation": "不要编辑这些*NgFactory*!重新编译时会替换这些文件,你做的所有修改都会丢失。", @@ -1825,20 +1785,10 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md" }, { - "original": "
\n `@types` and node modules\n
", + "original": "", "translation": "
\n @Types和node模块\n
In the file structure of _this particular sample project_,\nthe `node_modules` folder happens to be two levels up from the project root.\nTherefore, `\"typeRoots\"` must be set to `\"../../node_modules/@types/\"`.", "sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md" }, - { - "original": "
\n @Types和node模块\n
In the file structure of _this particular sample project_,\nthe `node_modules` folder happens to be two levels up from the project root.\nTherefore, `\"typeRoots\"` must be set to `\"../../node_modules/@types/\"`.", - "translation": "在**这个特定的示例项目**的文件结构中,`node_modules`文件恰好比项目根目录高两级。\n因此,`\"typeRoots\"`必须设置为`\"../../node_modules/@types/\"`。In a more typical project, `node_modules` would be a sibling of `tsconfig-aot.json`\nand `\"typeRoots\"` would be set to `\"node_modules/@types/\"`.\nEdit your `tsconfig-aot.json` to fit your project's file structure.", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md" - }, - { - "original": "在**这个特定的示例项目**的文件结构中,`node_modules`文件恰好比项目根目录高两级。\n因此,`\"typeRoots\"`必须设置为`\"../../node_modules/@types/\"`。In a more typical project, `node_modules` would be a sibling of `tsconfig-aot.json`\nand `\"typeRoots\"` would be set to `\"node_modules/@types/\"`.\nEdit your `tsconfig-aot.json` to fit your project's file structure.", - "translation": "在一个更典型的项目中,`node_modules`位于`tsconfig-aot.json`同级,\n这时`\"typeRoots\"`应设置为`\"node_modules/@types/\"`。\n编辑你的`tsconfig-aot.json`,使之适合项目的文件结构。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md" - }, { "original": "### Tree shaking", "translation": "### 摇树优化", @@ -1860,7 +1810,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md" }, { - "original": "The following instructions presuppose that you have downloaded the\n Tour of Heroes' zip\n and run `npm install` on it.", + "original": "and run `npm install` on it.", "translation": "下列步骤假设你已经下载了《英雄指南》的zip包,并且在其中运行过了`npm install`。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md" }, @@ -1919,11 +1869,6 @@ "translation": "`source-map-explorer`分析从包生成的源映射,并画出一个依赖地图,显示包中包含哪些应用程序和Angular模块和类。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md" }, - { - "original": "`source-map-explorer`分析从包生成的源映射,并画出一个依赖地图,显示包中包含哪些应用程序和Angular模块和类。", - "translation": "Here's the map for _Tour of Heroes_.\n下面是英雄指南的地图:\n
\n \"toh-pt6-bundle\"\n
\n
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md" - }, { "original": "# Architecture Overview", "translation": "# 架构概览", @@ -1954,21 +1899,11 @@ "translation": "当然,这只是冰山一角。后面我们将学习更多的细节。不过,目前我们还是先关注全景图吧。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, - { - "original": "The code referenced on this page is available as a .", - "translation": "

\n 本章所引用的代码见。\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "## Modules", "translation": "## 模块", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, - { - "original": "## 模块", - "translation": "\"模块\"", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "Angular apps are modular and Angular has its own modularity system called _NgModules_.", "translation": "Angular 应用是模块化的,并且 Angular 有自己的模块系统,它被称为 _Angular 模块_或 _NgModules_。", @@ -1995,7 +1930,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, { - "original": "Decorators are functions that modify JavaScript classes.\n Angular has many decorators that attach metadata to classes so that it knows\n what those classes mean and how they should work.\n \n Learn more about decorators on the web.", + "original": "Learn more about decorators on the web.", "translation": "装饰器是用来修饰 JavaScript 类的函数。\nAngular 有很多装饰器,它们负责把元数据附加到类上,以了解那些类的设计意图以及它们应如何工作。\n关于装饰器的更多信息。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, @@ -2065,8 +2000,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, { - "original": "", + "original": "Learn more about the JavaScript module system on the web.", + "translation": "学习更多关于 JavaScript 模块的知识。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, { @@ -2089,11 +2024,6 @@ "translation": "每个 Angular 库的名字都带有`@angular`前缀。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, - { - "original": "每个 Angular 库的名字都带有`@angular`前缀。", - "translation": "You install them with the **npm** package manager and import parts of them with JavaScript `import` statements.\n用 **npm** 包管理工具安装它们,用 JavaScript 的`import`语句导入其中某些部件。
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "For example, import Angular's `Component` decorator from the `@angular/core` library like this:", "translation": "例如,象下面这样,从`@angular/core`库中导入`Component`装饰器:", @@ -2119,11 +2049,6 @@ "translation": "这两个系统比较容易混淆,因为它们共享相同的词汇 “imports” 和 “exports”。不过没关系,先放一放,随着时间和经验的增长,自然就清楚了。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, - { - "original": "
", - "translation": "Learn more from the [NgModules](guide/ngmodule) page.\n更多信息,见 [Angular 模块](guide/ngmodule)。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "## Components", "translation": "## 组件", @@ -2174,11 +2099,6 @@ "translation": "## 模板", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, - { - "original": "## 模板", - "translation": "\"模板\"", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "You define a component's view with its companion **template**. A template is a form of HTML\nthat tells Angular how to render the component.", "translation": "我们通过组件的自带的**模板**来定义组件视图。模板以 HTML 形式存在,告诉 Angular 如何渲染组件。", @@ -2214,14 +2134,9 @@ "translation": "## 元数据", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, - { - "original": "## 元数据", - "translation": "\"元数据\"", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "Metadata tells Angular how to process a class.", - "translation": "

元数据告诉 Angular 如何处理一个类。

\n
", + "translation": "元数据告诉 Angular 如何处理一个类。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, { @@ -2284,11 +2199,6 @@ "translation": "模板、元数据和组件共同描绘出这个视图。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, - { - "original": "模板、元数据和组件共同描绘出这个视图。", - "translation": "Apply other metadata decorators in a similar fashion to guide Angular behavior.\n`@Injectable`, `@Input`, and `@Output` are a few of the more popular decorators.其它元数据装饰器用类似的方式来指导 Angular 的行为。\n例如`@Injectable`、`@Input`和`@Output`等是一些最常用的装饰器。
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "The architectural takeaway is that you must add metadata to your code\nso that Angular knows what to do.", "translation": "这种架构处理方式是:你向代码中添加元数据,以便 Angular 知道该怎么做。", @@ -2304,11 +2214,6 @@ "translation": "如果没有框架,我们就得自己把数据值推送到 HTML 控件中,并把用户的反馈转换成动作和值更新。\n如果手工写代码来实现这些推/拉逻辑,肯定会枯燥乏味、容易出错,读起来简直是噩梦 —— 写过 jQuery 的程序员大概都对此深有体会。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, - { - "original": "如果没有框架,我们就得自己把数据值推送到 HTML 控件中,并把用户的反馈转换成动作和值更新。\n如果手工写代码来实现这些推/拉逻辑,肯定会枯燥乏味、容易出错,读起来简直是噩梦 —— 写过 jQuery 的程序员大概都对此深有体会。", - "translation": "\"数据绑定\"", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "Angular supports **data binding**,\na mechanism for coordinating parts of a template with parts of a component.\nAdd binding markup to the template HTML to tell Angular how to connect both sides.", "translation": "Angular 支持**数据绑定**,一种让模板的各部分与组件的各部分相互合作的机制。\n我们往模板 HTML 中添加绑定标记,来告诉 Angular 如何把二者联系起来。As the diagram shows, there are four forms of data binding syntax. Each form has a direction — to the DOM, from the DOM, or in both directions.如图所示,数据绑定的语法有四种形式。每种形式都有一个方向 —— 绑定到 DOM 、绑定自 DOM 以及双向绑定。
", @@ -2349,19 +2254,9 @@ "translation": "Angular 在每个 JavaScript 事件循环中处理*所有的*数据绑定,它会从组件树的根部开始,递归处理全部子组件。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, - { - "original": "Angular 在每个 JavaScript 事件循环中处理*所有的*数据绑定,它会从组件树的根部开始,递归处理全部子组件。", - "translation": "
\n \"数据绑定\"\n
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "Data binding plays an important role in communication between a template and its component.", - "translation": "数据绑定在模板与对应组件的交互中扮演了重要的角色。\n
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, - { - "original": "数据绑定在模板与对应组件的交互中扮演了重要的角色。\n
", - "translation": "
\n \"父/子绑定\"\n
", + "translation": "数据绑定在模板与对应组件的交互中扮演了重要的角色。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, { @@ -2374,11 +2269,6 @@ "translation": "## 指令 (directive)", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, - { - "original": "## 指令 (directive)", - "translation": "\"父与子\"", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "Angular templates are *dynamic*. When Angular renders them, it transforms the DOM\naccording to the instructions given by **directives**.", "translation": "Angular 模板是*动态的*。当 Angular 渲染它们时,它会根据**指令**提供的操作对 DOM 进行转换。", @@ -2564,11 +2454,6 @@ "translation": "`HeroService`注入的过程差不多是这样的:", "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" }, - { - "original": "`HeroService`注入的过程差不多是这样的:", - "translation": "
\n \"服务\"\n
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/architecture.md" - }, { "original": "If the injector doesn't have a `HeroService`, how does it know how to make one?", "translation": "如果注入器还没有`HeroService`,它怎么知道该如何创建一个呢?", @@ -2925,7 +2810,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/attribute-directives.md" }, { - "original": "

Your directive isn't working?

", + "original": "Your directive isn't working?", "translation": "### 你的指令没生效?", "sourceFile": "/Users/twer/private/GDE/content-1/guide/attribute-directives.md" }, @@ -3495,13 +3380,13 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { - "original": "

\n latest\n

", - "translation": "

\n 最新版\n

", + "original": "

", + "translation": "

\n 最新版", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { - "original": "

\n latest\n

", - "translation": "

\n 最新版\n

", + "original": "

", + "translation": "

\n 最新版", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { @@ -3514,11 +3399,6 @@ "translation": "## Polyfills #\n## 填充库 (polyfill) #\nAngular is built on the latest standards of the web platform.\nTargeting such a wide range of browsers is challenging because they do not support all features of modern browsers.", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, - { - "original": "## Polyfills #\n## 填充库 (polyfill) #\nAngular is built on the latest standards of the web platform.\nTargeting such a wide range of browsers is challenging because they do not support all features of modern browsers.", - "translation": "Angular 构建于 Web 平台的最新标准之上。\n要支持这么多浏览器是一个不小的挑战,因为它们不支持现代浏览器的所有特性。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" - }, { "original": "You can compensate by loading polyfill scripts (\"polyfills\") on the host web page (`index.html`)\nthat implement missing features in JavaScript.", "translation": "你可以通过在宿主页面 (`index.html`) 中加载填充脚本 (“polyfills”) 来加以弥补,这些脚本实现了浏览器缺失的 JavaScript 特性。", @@ -3545,18 +3425,13 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { - "original": "### Mandatory polyfills ##\n### 强制性填充库 ##\nThese are the polyfills required to run an Angular application on each supported browser:", - "translation": "下表是填充库对每个支持的浏览器都是需要的:", + "original": "

", + "translation": "

\n 浏览器(桌面和移动)", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { - "original": "

\n Browsers (Desktop & Mobile)\n

", - "translation": "

\n 浏览器(桌面和移动)\n

\n ", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" - }, - { - "original": "

\n Polyfills Required\n

", - "translation": "

\n 需要的填充库\n

", + "original": "

", + "translation": "

\n 需要的填充库", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { @@ -3564,11 +3439,6 @@ "translation": "### Optional browser features to polyfill ##\n### 可选浏览器特性的填充库 ##\nSome features of Angular may require additional polyfills.", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, - { - "original": "### Optional browser features to polyfill ##\n### 可选浏览器特性的填充库 ##\nSome features of Angular may require additional polyfills.", - "translation": "有些 Angular 特性可能需要额外的填充库。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" - }, { "original": "For example, the animations library relies on the standard web animation API, which is only available in Chrome and Firefox today.\nYou'll need a polyfill to use animations in other browsers.", "translation": "例如,动画库依赖于标准的 web 动画 API,目前它只在 Chrome 和 Firefox 上可用。你可能需要一个填充库来在其它浏览器上使用动画功能。", @@ -3580,7 +3450,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { - "original": "

", + "original": "[NgClass](api/common/NgClass) on SVG elements", + "translation": "在 SVG 元素上应用 [NgClass](api/common/NgClass)", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { - "original": "

[Http](guide/http) when sending and receiving binary data

", - "translation": "

用 [Http](guide/http) 发送和接收二进制数据

", + "original": "[Http](guide/http) when sending and receiving binary data", + "translation": "用 [Http](guide/http) 发送和接收二进制数据", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { @@ -3635,28 +3505,23 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { - "original": "### Suggested polyfills ##\n### 建议的填充库 ##\nBelow are the polyfills which are used to test the framework itself. They are a good starting point for an application.", - "translation": "下表中是用来测试框架本身的填充库,它们是应用程序的优质起点。", + "original": "

", + "translation": "

\n 填充库", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { - "original": "

\n Polyfill\n

", - "translation": "

\n 填充库\n

", + "original": "

", + "translation": "

\n 授权方式", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { - "original": "

\n Licence\n

", - "translation": "

\n 授权方式\n

", + "original": "

", + "translation": "

\n 大小*", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { - "original": "

\n Size*\n

", - "translation": "

\n 大小*\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" - }, - { - "original": "

\n Public domain\n

", - "translation": "

\n 公共域\n

", + "original": "

", + "translation": "

\n 公共域", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { @@ -3684,11 +3549,6 @@ "translation": "## 移除了所有的moduleId引用。移除了“组件相对路径” 的烹饪书。(2017-03-13)\nWe added a new SystemJS plugin (systemjs-angular-loader.js) to our recommended SystemJS configuration.\nThis plugin dynamically converts \"component-relative\" paths in templateUrl and styleUrls to \"absolute paths\" for you.", "sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md" }, - { - "original": "## 移除了所有的moduleId引用。移除了“组件相对路径” 的烹饪书。(2017-03-13)\nWe added a new SystemJS plugin (systemjs-angular-loader.js) to our recommended SystemJS configuration.\nThis plugin dynamically converts \"component-relative\" paths in templateUrl and styleUrls to \"absolute paths\" for you.", - "translation": "我们往建议的SystemJS配置中新增了一个SystemJS插件 (systemjs-angular-loader.js) 。\n这个插件可以帮你把templateUrl和styleUrls中的组件相对路径动态转换为绝对路径。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md" - }, { "original": "We strongly encourage you to only write component-relative paths.\nThat is the only form of URL discussed in these docs. You no longer need to write @Component({ moduleId: module.id }), nor should you.", "translation": "我们强烈建议你只写组件相对路径。\n这也是本文档中所使用的唯一形式。你不必再写`@Component({ moduleId: module.id })`,而且也不应该再这么写。", @@ -3725,7 +3585,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md" }, { - "original": "All samples now have a `src/` folder at the project root.\nThe former `app/` folder moves under `src/`.\nRead about moving your existing project to this structure in\n\nthe QuickStart repo update instructions.", + "original": "the QuickStart repo update instructions.", "translation": "我们已经把所有范例改成了使用项目根目录下的`src/`文件夹。\n也就是把以前的`app/`文件夹移到了`src/`文件夹下面。\n要了解如何对你的现有工程进行这种迁移,请参阅QuickStart中的迁移指南。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md" }, @@ -3791,11 +3651,11 @@ }, { "original": "## Miscellaneous (2017-01-05)", - "translation": "## 杂项 (2017-01-05)* [Setup](guide/setup) guide: \nadded (optional) instructions on how to remove _non-essential_ files. [环境搭建](guide/setup)指南:\n 添加了(可选的)步骤说明,告诉你如何移除*非核心*文件。\n* No longer consolidate RxJS operator imports in `rxjs-extensions` file; each file should import what it needs.", + "translation": "## 杂项 (2017-01-05)* [Setup](guide/setup) guide: \nadded (optional) instructions on how to remove _non-essential_ files. [环境搭建](guide/setup)指南:\n 添加了(可选的)步骤说明,告诉你如何移除*非核心*文件。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md" }, { - "original": "## 杂项 (2017-01-05)* [Setup](guide/setup) guide: \nadded (optional) instructions on how to remove _non-essential_ files. [环境搭建](guide/setup)指南:\n 添加了(可选的)步骤说明,告诉你如何移除*非核心*文件。\n* No longer consolidate RxJS operator imports in `rxjs-extensions` file; each file should import what it needs.", + "original": "* No longer consolidate RxJS operator imports in `rxjs-extensions` file; each file should import what it needs.", "translation": "不再在`rxjs-extensions`文件中统一导入RxJS的操作符,每个文件应该各自导入它自己所需的。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md" }, @@ -4054,11 +3914,6 @@ "translation": "[StyleGuide](guide/styleguide)解释了我们为Angular模块(NgModule)而推荐的约定。\nBarrels now are far less useful and have been removed from the style guide;\nthey remain valuable but are not a matter of Angular style.\nAlso relaxed the rule that discouraged use of the `@Component.host` property.", "sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md" }, - { - "original": "[StyleGuide](guide/styleguide)解释了我们为Angular模块(NgModule)而推荐的约定。\nBarrels now are far less useful and have been removed from the style guide;\nthey remain valuable but are not a matter of Angular style.\nAlso relaxed the rule that discouraged use of the `@Component.host` property.", - "translation": "现在,封装桶不再那么重要,风格指南已经移除了它们。\n它们仍然很有价值,但是它们与Angular风格无关。\n我们同时对**不推荐使用`@Component.host`属性**的规则有所放宽。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md" - }, { "original": "## _moduleId: module.id_ everywhere (2016-09-25)", "translation": "## moduleId:到处添加module.id(2016-09-25)", @@ -4085,68 +3940,408 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md" }, { - "original": "

Cheat Sheet

", - "translation": "

速查表

", + "original": "Cheat Sheet", + "translation": "速查表", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "

速查表

", - "translation": "
\n
", - "translation": "### none\n ### 没了\n For performance reasons, no comparable pipe exists in Angular. Do all your filtering in the component. If you need the same filtering code in several templates, consider building a custom pipe.", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" - }, - { - "original": "### none\n ### 没了\n For performance reasons, no comparable pipe exists in Angular. Do all your filtering in the component. If you need the same filtering code in several templates, consider building a custom pipe.", - "translation": "在Angular中,出于性能的考虑,并没有一个类似的管道。\n 过滤逻辑应该在组件中用代码实现。\n 如果它将被复用在几个模板中,可以考虑构建一个自定义管道。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" - }, { "original": "Converts a JavaScript object into a JSON string. This is useful for debugging.", "translation": "把一个JavaScript对象转换成一个JSON字符串。这对调试很有用。", @@ -586,17 +576,17 @@ }, { "original": "The Angular `json` pipe does the same thing.", - "translation": "Angular的`json`管道做完全相同的事。\n ", - "translation": "### none\n ### 没了\n For performance reasons, no comparable pipe exists in Angular.\n Instead, use component code to order or sort results. If you need the same ordering or sorting code in several templates, consider building a custom pipe.", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" - }, - { - "original": "### none\n ### 没了\n For performance reasons, no comparable pipe exists in Angular.\n Instead, use component code to order or sort results. If you need the same ordering or sorting code in several templates, consider building a custom pipe.", - "translation": "在Angular中,出于性能的考虑,并没有一个类似的管道。\n 排序逻辑应该在组件中用代码实现。\n 如果它将被复用在几个模板中,可以考虑构建一个自定义管道。", + "translation": "使用表达式中所指定的方式对集合进行排序。\n 在这个例子中,`movieList`被根据movie的title排序了。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" }, { @@ -686,7 +666,7 @@ }, { "original": "In AngularJS, an Angular module keeps track of controllers, services, and other code. \n The second argument defines the list of other modules that this module depends upon.", - "translation": "在AngularJS中,Angular模块用来对控制器、服务和其它代码进行跟踪。第二个参数定义该模块依赖的其它模块列表。\n ", - "translation": "### Controller registration\n### 控制器注册 \n angular\n .module(\"movieHunter\")\n .controller(\"MovieListCtrl\",\n [\"movieService\",\n MovieListCtrl]);\n ", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md" - }, { "original": "AngularJS has code in each controller that looks up an appropriate Angular module\n and registers the controller with that module.", "translation": "在AngularJS中,在每个控制器中都有一些代码,用于找到合适的Angular模块并把该控制器注册进去。", @@ -751,7 +726,7 @@ }, { "original": "In AngularJS, you write the code for the model and methods in a controller function.", - "translation": "在Angular1中,我们在控制器函数中写模型和方法的代码。\n \n Feature", + "original": "Feature", "translation": "特性", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, @@ -3601,7 +3471,7 @@ }, { "original": "[Web Animations](guide/browser-support#web-animations)", - "translation": "[Web 动画](guide/browser-support#web-animations)\n ", + "translation": "[Web 动画](guide/browser-support#web-animations)", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { @@ -3615,18 +3485,18 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { - "original": "\n

All but Chrome, Firefox, Edge, IE11 and Safari 10

", - "translation": "

除了 Chrome、Firefox、Edge、IE11 和 Safari 10 外的所有浏览器

", + "original": "All but Chrome, Firefox, Edge, IE11 and Safari 10", + "translation": "除了 Chrome、Firefox、Edge、IE11 和 Safari 10 外的所有浏览器", "sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md" }, { - "original": "

[NgClass](api/common/NgClass) on SVG elements

", - "translation": "

在 SVG 元素上应用 [NgClass](api/common/NgClass)

\n
\n\n\n\n\n\n\n\n\n
\n

Bootstrapping

\n

启动

\n

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

\n
platformBrowserDynamic().bootstrapModule(AppModule);

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

\n

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

\n
", + "original": "Bootstrapping", + "translation": "启动", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "
\n\n\n\n\n\n\n\n\n\n
\n

Bootstrapping

\n

启动

\n

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

\n
platformBrowserDynamic().bootstrapModule(AppModule);

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

\n

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

\n
", - "translation": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n

NgModules

\n

Angular 模块

\n

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

\n
@NgModule({ declarations: ..., imports: ...,
exports: ..., providers: ..., bootstrap: ...})
class MyModule {}

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

\n

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

\n
declarations: [MyRedComponent, MyBlueComponent, MyDatePipe]

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

\n

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

\n
imports: [BrowserModule, SomeOtherModule]

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

\n

本模块所导入的模块列表

\n
exports: [MyRedComponent, MyDatePipe]

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

\n

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

\n
providers: [MyService, { provide: ... }]

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

\n

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

\n
bootstrap: [MyAppComponent]

List of components to bootstrap when this module is bootstrapped.

\n

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

\n
", + "original": "

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

", + "translation": "用 NgModule 中指定的根组件进行启动。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n

NgModules

\n

Angular 模块

\n

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

\n
@NgModule({ declarations: ..., imports: ...,
exports: ..., providers: ..., bootstrap: ...})
class MyModule {}

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

\n

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

\n
declarations: [MyRedComponent, MyBlueComponent, MyDatePipe]

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

\n

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

\n
imports: [BrowserModule, SomeOtherModule]

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

\n

本模块所导入的模块列表

\n
exports: [MyRedComponent, MyDatePipe]

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

\n

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

\n
providers: [MyService, { provide: ... }]

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

\n

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

\n
bootstrap: [MyAppComponent]

List of components to bootstrap when this module is bootstrapped.

\n

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

\n
", - "translation": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Template syntax

\n

模板语法

\n
<input [value]=\"firstName\">

Binds property value to the result of expression firstName.

\n

value属性绑定到表达式firstName

\n
<div [attr.role]=\"myAriaRole\">

Binds attribute role to the result of expression myAriaRole.

\n

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

\n
<div [class.extra-sparkle]=\"isDelightful\">

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

\n

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

\n
<div [style.width.px]=\"mySize\">

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

\n

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

\n
<button (click)=\"readRainbow($event)\">

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

\n

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

\n
<div title=\"Hello {{ponyName}}\">

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

\n

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

\n
<p>Hello {{ponyName}}</p>

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

\n

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

\n
<my-cmp [(title)]=\"name\">

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

\n

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

\n
<video #movieplayer ...>
<button (click)=\"movieplayer.play()\">
</video>

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

\n

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

\n
<p *myUnless=\"myExpression\">...</p>

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

\n

星号*会把当前元素转换成内嵌式模板,等价于:<template [myUnless]=\"myExpression\"><p>...</p></template>

\n
<p>Card No.: {{cardNumber | myCardNumberFormatter}}</p>

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

\n

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

\n
<p>Employer: {{employer?.companyName}}</p>

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

\n

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

\n
<svg:rect x=\"0\" y=\"0\" width=\"100\" height=\"100\"/>

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

\n

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

\n
<svg>
<rect x=\"0\" y=\"0\" width=\"100\" height=\"100\"/>
</svg>

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

\n

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

\n
", + "original": "

NgModules

", + "translation": "Angular 模块", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Template syntax

\n

模板语法

\n
<input [value]=\"firstName\">

Binds property value to the result of expression firstName.

\n

value属性绑定到表达式firstName

\n
<div [attr.role]=\"myAriaRole\">

Binds attribute role to the result of expression myAriaRole.

\n

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

\n
<div [class.extra-sparkle]=\"isDelightful\">

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

\n

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

\n
<div [style.width.px]=\"mySize\">

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

\n

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

\n
<button (click)=\"readRainbow($event)\">

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

\n

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

\n
<div title=\"Hello {{ponyName}}\">

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

\n

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

\n
<p>Hello {{ponyName}}</p>

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

\n

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

\n
<my-cmp [(title)]=\"name\">

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

\n

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

\n
<video #movieplayer ...>
<button (click)=\"movieplayer.play()\">
</video>

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

\n

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

\n
<p *myUnless=\"myExpression\">...</p>

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

\n

星号*会把当前元素转换成内嵌式模板,等价于:<template [myUnless]=\"myExpression\"><p>...</p></template>

\n
<p>Card No.: {{cardNumber | myCardNumberFormatter}}</p>

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

\n

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

\n
<p>Employer: {{employer?.companyName}}</p>

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

\n

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

\n
<svg:rect x=\"0\" y=\"0\" width=\"100\" height=\"100\"/>

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

\n

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

\n
<svg>
<rect x=\"0\" y=\"0\" width=\"100\" height=\"100\"/>
</svg>

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

\n

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

\n
", - "translation": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Built-in directives

\n

内置指令

\n

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

\n
<section *ngIf=\"showSection\">

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

\n

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

\n
<li *ngFor=\"let item of list\">

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

\n

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

\n
<div [ngSwitch]=\"conditionExpression\">
<template [ngSwitchCase]=\"case1Exp\">...</template>
<template ngSwitchCase=\"case2LiteralString\">...</template>
<template ngSwitchDefault>...</template>
</div>

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

\n

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

\n
<div [ngClass]=\"{'active': isActive, 'disabled': isDisabled}\">

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.

\n

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

\n
", + "original": "

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

", + "translation": "定义一个模块,其中可以包含组件、指令、管道和服务提供商。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Built-in directives

\n

内置指令

\n

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

\n
<section *ngIf=\"showSection\">

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

\n

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

\n
<li *ngFor=\"let item of list\">

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

\n

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

\n
<div [ngSwitch]=\"conditionExpression\">
<template [ngSwitchCase]=\"case1Exp\">...</template>
<template ngSwitchCase=\"case2LiteralString\">...</template>
<template ngSwitchDefault>...</template>
</div>

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

\n

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

\n
<div [ngClass]=\"{'active': isActive, 'disabled': isDisabled}\">

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.

\n

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

\n
", - "translation": "\n\n\n\n\n\n\n\n\n
\n

Forms

\n

表单

\n

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

\n
<input [(ngModel)]=\"userName\">

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

\n

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

\n
", + "original": "

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

", + "translation": "属于当前模块的组件、指令和管道的列表。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "\n\n\n\n\n\n\n\n\n
\n

Forms

\n

表单

\n

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

\n
<input [(ngModel)]=\"userName\">

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

\n

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

\n
", - "translation": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Class decorators

\n

类装饰器(decorator)

\n

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

\n
@Component({...})
class MyComponent() {}

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

\n

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

\n
@Directive({...})
class MyDirective() {}

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

\n

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

\n
@Pipe({...})
class MyPipe() {}

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

\n

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

\n
@Injectable()
class MyService() {}

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

\n

声明一个类具有一些依赖,当依赖注入器试图创建该类的实例时,应该把这些依赖注入到该类的构造函数中。

\n
", + "original": "imports: [BrowserModule, SomeOtherModule]\n

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

", + "translation": "本模块所导入的模块列表", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Class decorators

\n

类装饰器(decorator)

\n

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

\n
@Component({...})
class MyComponent() {}

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

\n

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

\n
@Directive({...})
class MyDirective() {}

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

\n

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

\n
@Pipe({...})
class MyPipe() {}

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

\n

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

\n
@Injectable()
class MyService() {}

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

\n

声明一个类具有一些依赖,当依赖注入器试图创建该类的实例时,应该把这些依赖注入到该类的构造函数中。

\n
", - "translation": "\n\n\n\n\n\n\n\n\n\n\n\n
\n

Directive configuration

\n

指令配置

\n

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

\n
selector: '.cool-button:not(a)'

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

\n

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

\n

Does not support parent-child relationship selectors.

\n

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

\n
providers: [MyService, { provide: ... }]

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

\n

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

\n
", + "original": "

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

", + "translation": "那些导入了本模块的模块所能看到的组件、指令和管道的列表", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "\n\n\n\n\n\n\n\n\n\n\n\n
\n

Directive configuration

\n

指令配置

\n

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

\n
selector: '.cool-button:not(a)'

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

\n

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

\n

Does not support parent-child relationship selectors.

\n

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

\n
providers: [MyService, { provide: ... }]

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

\n

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

\n
", - "translation": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Component configuration

\n

组件配置

\n

\n@Component extends @Directive,\nso the @Directive configuration applies to components as well

\n

@Component 继承自 @Directive,因此 @Directive 的配置也能用于 @Component

\n
moduleId: module.id

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

\n

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

\n
viewProviders: [MyService, { provide: ... }]

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

\n

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

\n
template: 'Hello {{name}}'
templateUrl: 'my-component.html'

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

\n

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

\n
styles: ['.primary {color: red}']
styleUrls: ['my-component.css']

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

\n

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

\n
", + "original": "

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

", + "translation": "依赖注入提供商的列表,本模块以及本模块导入的所有模块中的内容都可以看见它们。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Component configuration

\n

组件配置

\n

\n@Component extends @Directive,\nso the @Directive configuration applies to components as well

\n

@Component 继承自 @Directive,因此 @Directive 的配置也能用于 @Component

\n
moduleId: module.id

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

\n

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

\n
viewProviders: [MyService, { provide: ... }]

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

\n

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

\n
template: 'Hello {{name}}'
templateUrl: 'my-component.html'

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

\n

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

\n
styles: ['.primary {color: red}']
styleUrls: ['my-component.css']

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

\n

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

\n
", - "translation": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Class field decorators for directives and components

\n

给指令或组件类用的属性装饰器

\n

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

\n
@Input() myProperty;

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

\n

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

\n
@Output() myEvent = new EventEmitter();

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

\n

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

\n
@HostBinding('class.valid') isValid;

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

\n

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

\n
@HostListener('click', ['$event']) onClick(e) {...}

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

\n

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

\n
@ContentChild(myPredicate) myChildComponent;

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

\n

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

\n
@ContentChildren(myPredicate) myChildComponents;

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

\n

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

\n
@ViewChild(myPredicate) myChildComponent;

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

\n

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

\n
@ViewChildren(myPredicate) myChildComponents;

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

\n

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

\n
", + "original": "

List of components to bootstrap when this module is bootstrapped.

", + "translation": "当本模块启动时,随之启动的组件列表。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Class field decorators for directives and components

\n

给指令或组件类用的属性装饰器

\n

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

\n
@Input() myProperty;

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

\n

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

\n
@Output() myEvent = new EventEmitter();

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

\n

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

\n
@HostBinding('class.valid') isValid;

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

\n

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

\n
@HostListener('click', ['$event']) onClick(e) {...}

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

\n

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

\n
@ContentChild(myPredicate) myChildComponent;

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

\n

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

\n
@ContentChildren(myPredicate) myChildComponents;

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

\n

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

\n
@ViewChild(myPredicate) myChildComponent;

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

\n

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

\n
@ViewChildren(myPredicate) myChildComponents;

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

\n

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

\n
", - "translation": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Directive and component change detection and lifecycle hooks

\n

指令和组件的变更检测与生命周期钩子

\n

(implemented as class methods)\n

\n

由类的方法实现。

\n
constructor(myService: MyService, ...) { ... }

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

\n

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

\n
ngOnChanges(changeRecord) { ... }

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

\n

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

\n
ngOnInit() { ... }

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

\n

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

\n
ngDoCheck() { ... }

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.

\n

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

\n
ngAfterContentInit() { ... }

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

\n

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

\n
ngAfterContentChecked() { ... }

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

\n

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

\n
ngAfterViewInit() { ... }

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

\n

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

\n
ngAfterViewChecked() { ... }

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

\n

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

\n
ngOnDestroy() { ... }

Called once, before the instance is destroyed.

\n

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

\n
", + "original": "Template syntax", + "translation": "模板语法", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Directive and component change detection and lifecycle hooks

\n

指令和组件的变更检测与生命周期钩子

\n

(implemented as class methods)\n

\n

由类的方法实现。

\n
constructor(myService: MyService, ...) { ... }

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

\n

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

\n
ngOnChanges(changeRecord) { ... }

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

\n

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

\n
ngOnInit() { ... }

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

\n

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

\n
ngDoCheck() { ... }

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.

\n

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

\n
ngAfterContentInit() { ... }

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

\n

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

\n
ngAfterContentChecked() { ... }

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

\n

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

\n
ngAfterViewInit() { ... }

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

\n

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

\n
ngAfterViewChecked() { ... }

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

\n

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

\n
ngOnDestroy() { ... }

Called once, before the instance is destroyed.

\n

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

\n
", - "translation": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Dependency injection configuration

\n

依赖注入的配置

\n
{ provide: MyService, useClass: MyMockService }

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

\n

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

\n
{ provide: MyService, useFactory: myFactory }

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

\n

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

\n
{ provide: MyValue, useValue: 41 }

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

\n

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

\n
", + "original": "

Binds property value to the result of expression firstName.

", + "translation": "把value属性绑定到表达式firstName", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { - "original": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Dependency injection configuration

\n

依赖注入的配置

\n
{ provide: MyService, useClass: MyMockService }

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

\n

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

\n
{ provide: MyService, useFactory: myFactory }

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

\n

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

\n
{ provide: MyValue, useValue: 41 }

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

\n

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

\n
", - "translation": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n

Routing and navigation

\n

路由与导航

\n

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

\n
const routes: Routes = [
{ path: '', component: HomeComponent },
{ path: 'path/:routeParam', component: MyComponent },
{ path: 'staticPath', component: ... },
{ path: '**', component: ... },
{ path: 'oldPath', redirectTo: '/staticPath' },
{ path: ..., component: ..., data: { message: 'Custom' } }
]);

const routing = RouterModule.forRoot(routes);

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

\n

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

\n

<router-outlet></router-outlet>
<router-outlet name=\"aux\"></router-outlet>

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

\n

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

\n

<a routerLink=\"/path\">
<a [routerLink]=\"[ '/path', routeParam ]\">
<a [routerLink]=\"[ '/path', { matrixParam: 'value' } ]\">
<a [routerLink]=\"[ '/path' ]\" [queryParams]=\"{ page: 1 }\">
<a [routerLink]=\"[ '/path' ]\" fragment=\"anchor\">

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.

\n

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

\n
<a [routerLink]=\"[ '/path' ]\" routerLinkActive=\"active\">

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

\n

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

\n
class CanActivateGuard implements CanActivate {
canActivate(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<boolean>|Promise<boolean>|boolean { ... }
}

{ path: ..., canActivate: [CanActivateGuard] }

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.

\n

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

\n
class CanDeactivateGuard implements CanDeactivate<T> {
canDeactivate(
component: T,
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<boolean>|Promise<boolean>|boolean { ... }
}

{ path: ..., canDeactivate: [CanDeactivateGuard] }

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.

\n

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

\n
class CanActivateChildGuard implements CanActivateChild {
canActivateChild(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<boolean>|Promise<boolean>|boolean { ... }
}

{ path: ..., canActivateChild: [CanActivateGuard],
children: ... }

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.

\n

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

\n
class ResolveGuard implements Resolve<T> {
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<any>|Promise<any>|any { ... }
}

{ path: ..., resolve: [ResolveGuard] }

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.

\n

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

\n
class CanLoadGuard implements CanLoad {
canLoad(
route: Route
): Observable<boolean>|Promise<boolean>|boolean { ... }
}

{ path: ..., canLoad: [CanLoadGuard], loadChildren: ... }

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.

\n

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

\n
\n
", + "original": "

Binds attribute role to the result of expression myAriaRole.

", + "translation": "把属性(Attribute)role绑定到表达式myAriaRole的结果。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "根据isDelightful表达式的结果是否为真,决定CSS类extra-sparkle是否出现在当前元素上。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "把CSS样式属性width的px(像素)值绑定到表达式mySize的结果。单位是可选的。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "当这个按钮元素(及其子元素)上的click事件触发时,调用方法readRainbow,并把这个事件对象作为参数传进去。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "<div [title]=\"'Hello ' + ponyName\">

", + "translation": "把一个属性绑定到插值字符串(如\"Hello Seabiscuit\")。这种写法等价于<div [title]=\"'Hello ' + ponyName\">", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "把文本内容绑定到插值字符串(如\"Hello Seabiscuit\")", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "设置双向绑定。等价于<my-cmp [title]=\"name\" (titleChange)=\"name=$event\">。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "创建一个局部变量movieplayer,支持在当前模板的数据绑定和事件绑定表达式中访问video元素的实例。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "<template [myUnless]=\"myExpression\"><p>...</p></template>

", + "translation": "星号*会把当前元素转换成内嵌式模板,等价于:<template [myUnless]=\"myExpression\"><p>...</p></template>", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "使用名叫myCardNumberFormatter的管道对表达式cardNumber的当前值进行变幻", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "安全导航操作符(?)表示employer字段是可选的,如果它是 undefined ,那么表达式其余的部分就会被忽略,并返回 undefined。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "模板中的 SVG 片段需要给它的根元素加上svg:前缀,以便把 SVG 元素和 HTML 元素区分开。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "以<svg>作为根元素时会自动识别为 SVG 元素,不需要前缀。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "Built-in directives", + "translation": "内置指令", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "根据showSection表达式的结果,移除或重新创建 DOM 树的一部分。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "把li元素及其内容变成一个模板,并使用这个模板为列表中的每一个条目实例化一个视图。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "根据conditionExpression的当前值选择一个嵌入式模板,并用它替换这个 div 的内容。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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.

", + "translation": "根据 map 中的 value 是否为真,来决定该元素上是否出现与 name 对应的 CSS 类。右侧的表达式应该返回一个形如 {class-name: true/false} 的 map。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "Forms", + "translation": "表单", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "为表单控件提供双向数据绑定、解析和验证功能。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "Class decorators", + "translation": "类装饰器(decorator)", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "声明一个类是组件,并提供该组件的元数据。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "声明一个类是指令,并提供该指令的元数据。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "声明一个类是管道,并提供该管道的元数据。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

", + "translation": "声明一个类具有一些依赖,当依赖注入器试图创建该类的实例时,应该把这些依赖注入到该类的构造函数中。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "Directive configuration", + "translation": "指令配置", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "[attribute], .class, and :not().

", + "translation": "指定一个 CSS 选择器,用于在模板中标记出该指令。支持的选择器类型包括:元素名[属性名], .类名:not()。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "Does not support parent-child relationship selectors.", + "translation": "但不支持指定父子关系的选择器。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "该指令及其子指令的依赖注入提供商列表。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "Component configuration", + "translation": "组件配置", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "@Component extends @Directive,\nso the @Directive configuration applies to components as well

", + "translation": "@Component 继承自 @Directive,因此 @Directive 的配置也能用于 @Component。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "如果设置了,那么 templateUrlstyleUrl 的路径就会相对于当前组件进行解析。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "依赖注入提供商列表,但它们的范围被限定为当前组件的视图。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "当前组件视图的内联模板或外部模板的 URL 。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "用于为当前组件的视图提供样式的内联 CSS 或外部样式表 URL 的列表。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "Class field decorators for directives and components", + "translation": "给指令或组件类用的属性装饰器", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "<my-cmp [myProperty]=\"someExpression\">).

", + "translation": "声明一个输入属性,你可以通过属性绑定来更新它,如 <my-cmp [myProperty]=\"someExpression\">。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "声明一个输出属性,它发出事件,你可以用事件绑定来订阅它们(如:<my-cmp (myEvent)=\"doSomething()\">)。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "把宿主元素的一个属性(这里是 CSS 类 valid)绑定到指令或组件上的 isValid 属性。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "用指令或组件上的onClick方法订阅宿主元素上的click事件,并从中获取$event参数(可选)", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "把组件内容查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "把组件内容查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "把组件视图查询(myPredicate)的第一个结果绑定到该类的 myChildComponent 属性上。对指令无效。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "把组件视图查询(myPredicate)的全部结果绑定到该类的 myChildComponents 属性上。对指令无效。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "Directive and component change detection and lifecycle hooks", + "translation": "指令和组件的变更检测与生命周期钩子", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

", + "translation": "由类的方法实现。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "在任何其它生命周期钩子之前调用。可以用它来注入依赖项,但不要在这里做正事。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "每当输入属性发生变化时就会调用,但位于处理内容(ng-content)或子视图之前。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "在调用完构造函数、初始化完所有输入属性并首次调用过ngOnChanges之后调用。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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.

", + "translation": "每当对组件或指令的输入属性进行变更检测时就会调用。可以用它来扩展变更检测逻辑,执行自定义的检测逻辑。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "ngOnInit完成之后,当组件或指令的内容(ng-content)已经初始化完毕时调用。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "每当组件或指令的内容(ng-content)做变更检测时调用。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "当ngAfterContentInit完毕,并且组件的视图已经初始化完毕时调用。只适用于组件。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "当组件视图每次执行变更检测时调用。只适用于组件。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

Called once, before the instance is destroyed.

", + "translation": "只在实例被销毁前调用一次。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "Dependency injection configuration", + "translation": "依赖注入的配置", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "把 MyService 的服务提供商设置或改写为 MyMockService 类。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "把 MyService 的服务提供商设置或改写为 myFactory 工厂函数。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "把 MyValue 的服务提供商改写为一个特定的值 41 。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "Routing and navigation", + "translation": "路由与导航", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "为该应用配置路由。支持静态、参数化、重定向和通配符路由。也支持自定义路由数据和解析(resolve)函数。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "标记出一个位置,用来加载活动路由的组件。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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.

", + "translation": "使用路由体系创建一个到其它视图的链接。路由体系由路由路径、必要参数、可选参数、查询参数和文档片段组成。要导航到根路由,请使用/前缀;要导航到子路由,使用./前缀;要导航到兄弟路由或父级路由,使用../前缀。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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

", + "translation": "当 routerLink 指向的路由变成活动路由时,为当前元素添加一些类(比如这里的 active)。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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.

", + "translation": "用来定义类的接口。路由器会首先调用本接口来决定是否激活该路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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.

", + "translation": "用来定义类的接口。路由器会在导航离开前首先调用本接口以决定是否取消激活本路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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.

", + "translation": "用来定义类的接口。路由器会首先调用本接口来决定是否激活一个子路由。应该返回一个 boolean 或能解析成 booleanObservable/Promise。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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.

", + "translation": "用来定义类的接口。路由器会在渲染该路由之前,首先调用它来解析路由数据。应该返回一个值或能解析成值的 Observable/Promise。", + "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" + }, + { + "original": "

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.

", + "translation": "用来定义类的接口。路由器会首先调用它来决定是否应该加载一个惰性加载模块。应该返回一个 boolean 或能解析成 booleanObservable/Promise。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/cheatsheet.md" }, { @@ -4225,7 +4420,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, { - "original": "

Test it

", + "original": "Test it", "translation": "### 测试", "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, @@ -4260,7 +4455,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, { - "original": "

Test it

", + "original": "Test it", "translation": "### 测试", "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, @@ -4310,7 +4505,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, { - "original": "

Test it

", + "original": "Test it", "translation": "### 测试", "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, @@ -4355,7 +4550,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, { - "original": "

Test it

", + "original": "Test it", "translation": "### 测试", "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, @@ -4410,7 +4605,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, { - "original": "

Test it

", + "original": "Test it", "translation": "### 测试", "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, @@ -4500,8 +4695,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, { - "original": "

Test it

", - "translation": "

测试一下!

", + "original": "Test it", + "translation": "测试一下!", "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, { @@ -4560,7 +4755,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, { - "original": "

Test it

", + "original": "Test it", "translation": "### 测试", "sourceFile": "/Users/twer/private/GDE/content-1/guide/component-interaction.md" }, @@ -5455,8 +5650,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection-in-action.md" }, { - "original": "On the other hand, if you restore the `@Host()` decorator and comment out `@Optional`,\nthe application fails for lack of the required logger at the host component level.\n
\n`EXCEPTION: No provider for LoggerService! (HeroContactComponent -> LoggerService)`", - "translation": "另一方面,如果恢复`@Host()`装饰器,注释掉`@Optional`,应用程序就会运行失败,因为它在宿主组件级别找不到需要的日志服务。\n
\n`EXCEPTION: No provider for LoggerService! (HeroContactComponent -> LoggerService)`\n{@a component-element}", + "original": "`EXCEPTION: No provider for LoggerService! (HeroContactComponent -> LoggerService)`", + "translation": "另一方面,如果恢复`@Host()`装饰器,注释掉`@Optional`,应用程序就会运行失败,因为它在宿主组件级别找不到需要的日志服务。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection-in-action.md" }, { @@ -5514,11 +5709,6 @@ "translation": "我们通常在构造函数里面,为参数指定类型,让Angular来处理依赖注入。该参数类型就是依赖注入器所需的*令牌*。\nAngular把该令牌传给注入器,然后把得到的结果赋给参数。下面是一个典型的例子:", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection-in-action.md" }, - { - "original": "我们通常在构造函数里面,为参数指定类型,让Angular来处理依赖注入。该参数类型就是依赖注入器所需的*令牌*。\nAngular把该令牌传给注入器,然后把得到的结果赋给参数。下面是一个典型的例子:", - "translation": "", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection-in-action.md" - }, { "original": "Angular asks the injector for the service associated with the `LoggerService`\nand assigns the returned value to the `logger` parameter.", "translation": "Angular向注入器请求与`LoggerService`对应的服务,并将返回值赋给`logger`参数。", @@ -5539,11 +5729,6 @@ "translation": "新建的注入器中没有提供商。\nAngular会使用一些自带的提供商来初始化这些注入器。我们必须自行注册属于_自己_的提供商,通常用`组件`或者`指令`元数据中的`providers`数组进行注册。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection-in-action.md" }, - { - "original": "新建的注入器中没有提供商。\nAngular会使用一些自带的提供商来初始化这些注入器。我们必须自行注册属于_自己_的提供商,通常用`组件`或者`指令`元数据中的`providers`数组进行注册。", - "translation": "", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection-in-action.md" - }, { "original": "### Defining providers", "translation": "### 定义提供商", @@ -5554,11 +5739,6 @@ "translation": "简单的类提供商是最典型的例子。只要在`providers`数值里面提到该类就可以了。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection-in-action.md" }, - { - "original": "简单的类提供商是最典型的例子。只要在`providers`数值里面提到该类就可以了。", - "translation": "", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection-in-action.md" - }, { "original": "It's that simple because the most common injected service is an instance of a class.\nBut not every dependency can be satisfied by creating a new instance of a class.\nYou need other ways to deliver dependency values and that means you need other ways to specify a provider.", "translation": "注册类提供商之所以这么简单,是因为最常见的可注入服务就是一个类的实例。\n但是,并不是所有的依赖都只要创建一个类的新实例就可以交付了。我们还需要其它的交付方式,这意味着我们也需要其它方式来指定提供商。", @@ -5699,11 +5879,6 @@ "translation": "`HeroOfTheMonthComponent`构造函数的`logger`参数是一个`MinimalLogger`类型,支持TypeScript的编辑器里,只能看到它的两个成员`logs`和`logInfo`:", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection-in-action.md" }, - { - "original": "`HeroOfTheMonthComponent`构造函数的`logger`参数是一个`MinimalLogger`类型,支持TypeScript的编辑器里,只能看到它的两个成员`logs`和`logInfo`:", - "translation": "
\n \"MinimalLogger受限API\"\n
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection-in-action.md" - }, { "original": "Behind the scenes,Angular actually sets the `logger` parameter to the full service registered under the `LoggingService` token \nwhich happens to be the `DateLoggerService` that was [provided above](guide/dependency-injection-in-action#useclass).", "translation": "实际上,Angular确实想把`logger`参数设置为注入器里`LoggerService`的完整版本。只是在之前的提供商注册里使用了`useClass`,\n所以该完整版本被`DateLoggerService`取代了。", @@ -6074,11 +6249,6 @@ "translation": "想象组件树中的一个分支为:*Alice* -> *Barry* -> *Carol*。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection-in-action.md" }, - { - "original": "想象组件树中的一个分支为:*Alice* -> *Barry* -> *Carol*。", - "translation": "*Alice*和*Barry*都实现了这个`Parent`*类-接口*。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection-in-action.md" - }, { "original": "*Barry* is the problem. He needs to reach his parent, *Alice*, and also be a parent to *Carol*.\nThat means he must both *inject* the `Parent` *class-interface* to get *Alice* and\n*provide* a `Parent` to satisfy *Carol*.", "translation": "*Barry*是个问题。它需要访问它的父组件*Alice*,但同时它也是*Carol*的父组件。这个意味着它必须同时*注入*`Parent`*类-接口*来获取*Alice*,和*提供*一个`Parent`来满足*Carol*。", @@ -6554,11 +6724,6 @@ "translation": "`HeroListComponent`应该从注入的`HeroService`获取英雄数据。\n遵照依赖注入模式的要求,组件必须在它的构造函数中请求这些服务,[就像以前解释过的那样](guide/dependency-injection#ctor-injection)。\n只是个小改动:", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, - { - "original": "
", - "translation": "#### Focus on the constructor\n#### 来看看构造函数", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" - }, { "original": "Adding a parameter to the constructor isn't all that's happening here.", "translation": "往构造函数中添加参数并不是这里所发生的一切。", @@ -6665,8 +6830,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, { - "original": "
\n Suggestion: add @Injectable() to every service class\n
", - "translation": "
\n 建议:为每个服务类都添加 @Injectable()\n
", + "original": "", + "translation": "
\n 建议:为每个服务类都添加 @Injectable()", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, { @@ -6675,13 +6840,13 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, { - "original": "

\n Future proofing: No need to remember @Injectable() when you add a dependency later.\n

", - "translation": "

\n 面向未来: 没有必要记得在后来添加依赖的时候添加 @Injectable()。\n

", + "original": "

", + "translation": "

\n 面向未来: 没有必要记得在后来添加依赖的时候添加 @Injectable()。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, { - "original": "

\n Consistency: All services follow the same rules, and you don't have to wonder why a decorator is missing.\n

", - "translation": "

\n 一致性:所有的服务都遵循同样的规则,不需要考虑为什么某个地方少了一个。\n

", + "original": "

", + "translation": "

\n 一致性:所有的服务都遵循同样的规则,不需要考虑为什么某个地方少了一个。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, { @@ -6710,8 +6875,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, { - "original": "

\n Always include the parentheses\n
", - "translation": "
\n 别忘了带括号\n
", + "original": "
", + "translation": "
\n 别忘了带括号", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, { @@ -6755,8 +6920,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, { - "original": "如果忘了注册这个日志服务,Angular 会在首次查找这个日志服务时,抛出一个异常。", - "translation": "\n EXCEPTION: No provider for Logger! (HeroListComponent -> HeroService -> Logger)\n (异常:Logger类没有提供商!(HeroListComponent -> HeroService -> Logger))", + "original": "", + "translation": "EXCEPTION: No provider for Logger! (HeroListComponent -> HeroService -> Logger)\n (异常:Logger类没有提供商!(HeroListComponent -> HeroService -> Logger))", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, { @@ -7015,13 +7180,13 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, { - "original": "

\n What if the dependency value isn't a class? Sometimes the thing you want to inject is a\n string, function, or object.\n

", - "translation": "

\n 如果依赖值不是一个类呢?有时候想要注入的东西是一个字符串,函数或者对象。\n

", + "original": "

", + "translation": "

\n 如果依赖值不是一个类呢?有时候想要注入的东西是一个字符串,函数或者对象。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, { - "original": "

\n Applications often define configuration objects with lots of small facts\n (like the title of the application or the address of a web API endpoint)\n but these configuration objects aren't always instances of a class.\n They can be object literals such as this one:\n

", - "translation": "

\n 应用程序经常为很多很小的因素定义配置对象(例如应用程序的标题或网络API终点的地址)。\n 但是这些配置对象不总是类的实例,它们可能是对象,如下面这个:\n

", + "original": "

", + "translation": "

\n 应用程序经常为很多很小的因素定义配置对象(例如应用程序的标题或网络API终点的地址)。\n 但是这些配置对象不总是类的实例,它们可能是对象,如下面这个:", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, { @@ -7104,11 +7269,6 @@ "translation": "当使用`@Optional()`时,代码必须准备好如何处理空值。\n如果其它的代码没有注册一个 `logger`,注入器会设置该`logger`的值为空 null。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" }, - { - "original": "当使用`@Optional()`时,代码必须准备好如何处理空值。\n如果其它的代码没有注册一个 `logger`,注入器会设置该`logger`的值为空 null。", - "translation": "## Summary\n## 总结", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md" - }, { "original": "You learned the basics of Angular dependency injection in this page.\nYou can register various kinds of providers,\nand you know how to ask for an injected object (such as a service) by\nadding a parameter to a constructor.", "translation": "本章,我们学习了 Angular 依赖注入的基础知识。\n我们可以注册很多种类的提供商,知道如何通过添加构造函数的参数来请求一个注入对象(例如一个服务)。", @@ -7510,7 +7670,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md" }, { - "original": "Consider configuring _Webpack_ with the official\n\nAngular Ahead-of-Time Webpack Plugin.\nThis plugin transpiles the TypeScript application code,\nbundles lazy loaded `NgModules` separately,\nand performs AOT compilation — without any changes to the source code.", + "original": "Angular Ahead-of-Time Webpack Plugin.\nThis plugin transpiles the TypeScript application code,\nbundles lazy loaded `NgModules` separately,\nand performs AOT compilation — without any changes to the source code.", "translation": "考虑使用官方的\nAngular预编译插件来配置*Webpack*。\n这个插件会转译TypeScript代码、独立打包延迟加载的`NgModules`,而且不用对源码做任何修改就能执行AOT编译。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md" }, @@ -7530,7 +7690,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md" }, { - "original": "Tree shaking was popularized by\nRollup, a popular tool with an ecosystem of\nplugins for bundling, minification, and uglification.\nLearn more about tree shaking and dead code elmination in\n\nthis post by rollup-creator, Rich Harris.", + "original": "this post by rollup-creator, Rich Harris.", "translation": "常用的摇树优化工具是Rollup,一个带有查件的生态系统,可以完成打包、最小化和混淆。\n要了解关于摇树优化和消除死代码技术的更多知识,参见这个帖子,它的作者就是rollup之父Rich Harris。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md" }, @@ -7565,8 +7725,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md" }, { - "original": "The\n\nChrome DevTools Network Performance page is a good place to start learning about measuring performance.", - "translation": "\n Chrome开发工具的网络性能页是开始学习度量性能的好地方。", + "original": "", + "translation": "Chrome开发工具的网络性能页是开始学习度量性能的好地方。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md" }, { @@ -7625,8 +7785,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md" }, { - "original": "Angular应用默认运行在开发模式下,正如在浏览器控制台中看到的如下信息:", - "translation": "\n Angular is running in the development mode. Call enableProdMode() to enable the production mode.\n (Angular正运行在开发模式下。调用enableProdMode()来启用生产模式)", + "original": "", + "translation": "Angular is running in the development mode. Call enableProdMode() to enable the production mode.\n (Angular正运行在开发模式下。调用enableProdMode()来启用生产模式)", "sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md" }, { @@ -7780,7 +7940,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md" }, { - "original": "Angular developers may encounter a\n\ncross-origin resource sharing error when making a service request (typically a data service request).\nto a server other than the application's own host server.\nBrowsers forbid such requests unless the server permits them explicitly.", + "original": "cross-origin resource sharing error when making a service request (typically a data service request).\nto a server other than the application's own host server.\nBrowsers forbid such requests unless the server permits them explicitly.", "translation": "Angular开发者在向与该应用的宿主服务器不同域的服务器发起请求时,可能会遇到一种跨域资源共享(CORS)错误。\n浏览器会阻止该请求,除非得到那台服务器的明确许可。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/deployment.md" }, @@ -7979,11 +8139,6 @@ "translation": "现在,英雄们出现在了一个无序列表中。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/displaying-data.md" }, - { - "original": "现在,英雄们出现在了一个无序列表中。", - "translation": "

\n \"ngfor之后\"\n
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/displaying-data.md" - }, { "original": "## Creating a class for the data", "translation": "## 为数据创建一个类", @@ -8899,11 +9054,6 @@ "translation": "如果删除了英雄的名字,表单就会用醒目的样式把验证错误显示出来。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, - { - "original": "如果删除了英雄的名字,表单就会用醒目的样式把验证错误显示出来。", - "translation": "
\n \"无效!名字是必填项\"\n
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" - }, { "original": "Note that the *Submit* button is disabled, and the \"required\" bar to the left of the input control changes from green to red.", "translation": "注意,提交按钮被禁用了,而且输入控件左侧的“必填”条从绿色变为了红色。", @@ -9195,8 +9345,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, { - "original": "
\n Angular forms don't require a style library\n
", - "translation": "
\n Angular 表单不需要任何样式库\n
", + "original": "
", + "translation": "
\n Angular 表单不需要任何样式库", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, { @@ -9244,11 +9394,6 @@ "translation": "如果立即运行此应用,你将会失望。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, - { - "original": "如果立即运行此应用,你将会失望。", - "translation": "
\n \"没有数据绑定的早期表单\"\n
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" - }, { "original": "You don't see hero data because you're not binding to the `Hero` yet.\nYou know how to do that from earlier pages.\n[Displaying Data](guide/displaying-data) teaches property binding.\n[User Input](guide/user-input) shows how to listen for DOM events with an\nevent binding and how to update a component property with the displayed value.", "translation": "因为还没有绑定到某个英雄,所以看不到任何数据。\n解决方案见前面的章节。\n[显示数据](guide/displaying-data)介绍了属性绑定。\n[用户输入](guide/user-input)介绍了如何通过事件绑定来监听 DOM 事件,以及如何用显示值更新组件的属性。", @@ -9314,11 +9459,6 @@ "translation": "如果现在运行这个应用,开始在*姓名*输入框中键入,添加和删除字符,将看到它们从插值结果中显示和消失。\n某一瞬间,它可能是这样的:", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, - { - "original": "如果现在运行这个应用,开始在*姓名*输入框中键入,添加和删除字符,将看到它们从插值结果中显示和消失。\n某一瞬间,它可能是这样的:", - "translation": "
\n \"操作中的ngModel\"\n
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" - }, { "original": "The diagnostic is evidence that values really are flowing from the input box to the model and\nback again.", "translation": "诊断信息可以证明,数据确实从输入框流动到模型,再反向流动回来。", @@ -9390,33 +9530,33 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, { - "original": "

\n State\n

", - "translation": "

\n 状态\n

", + "original": "

", + "translation": "

\n 状态", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, { - "original": "

\n Class if true\n

", - "translation": "

\n 为真时的 CSS 类\n

", + "original": "

", + "translation": "

\n 为真时的 CSS 类", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, { - "original": "

\n Class if false\n

", - "translation": "

\n 为假时的 CSS 类\n

", + "original": "

", + "translation": "

\n 为假时的 CSS 类", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, { - "original": "

\n The control has been visited.\n

", - "translation": "

\n 控件被访问过。\n

", + "original": "

", + "translation": "

\n 控件被访问过。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, { - "original": "

\n The control's value has changed.\n

", - "translation": "

\n 控件的值变化了。\n

", + "original": "

", + "translation": "

\n 控件的值变化了。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, { - "original": "

\n The control's value is valid.\n

", - "translation": "

\n 控件的值有效。\n

", + "original": "

", + "translation": "

\n 控件的值有效。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, { @@ -9454,11 +9594,6 @@ "translation": "动作和它对应的效果如下:", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, - { - "original": "动作和它对应的效果如下:", - "translation": "

\n \"控件状态转换\"\n
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" - }, { "original": "You should see the following transitions and class names:", "translation": "我们会看到下列转换及其类名:", @@ -9484,11 +9619,6 @@ "translation": "可以在输入框的左侧添加带颜色的竖条,用于标记必填字段和无效输入:", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, - { - "original": "可以在输入框的左侧添加带颜色的竖条,用于标记必填字段和无效输入:", - "translation": "
\n \"无效表单\"\n
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" - }, { "original": "You achieve this effect by adding these class definitions to a new `forms.css` file\nthat you add to the project as a sibling to `index.html`:", "translation": "在新建的`forms.css`文件中,添加两个样式来实现这一效果。把这个文件添加到项目中,与`index.html`相邻。", @@ -9514,11 +9644,6 @@ "translation": "当用户删除姓名时,应该是这样的:", "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" }, - { - "original": "当用户删除姓名时,应该是这样的:", - "translation": "
\n \"必须填写姓名\"\n
", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/forms.md" - }, { "original": "To achieve this effect, extend the `` tag with the following:", "translation": "要达到这个效果,在``标签中添加:", @@ -10371,11 +10496,11 @@ }, { "original": "* [NgModules](guide/glossary#ngmodule).\nFor details and examples, see the [NgModules](guide/ngmodule) page.", - "translation": "[Angular 模块](guide/glossary#ngmodule),见[Angular 模块](guide/ngmodule)。\n* ES2015 modules, as described in this section.", + "translation": "[Angular 模块](guide/glossary#ngmodule),见[Angular 模块](guide/ngmodule)。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/glossary.md" }, { - "original": "[Angular 模块](guide/glossary#ngmodule),见[Angular 模块](guide/ngmodule)。\n* ES2015 modules, as described in this section.", + "original": "* ES2015 modules, as described in this section.", "translation": "本节描述的 ES2015 模块。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/glossary.md" }, @@ -11560,7 +11685,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/http.md" }, { - "original": "
\n*Note that `HttpClient`'s support is only the client half of the XSRF protection scheme.* Your backend service must be configured to set the cookie for your page, and to verify that the header is present on all eligible requests. If not, Angular's default protection will be ineffective.", + "original": "*Note that `HttpClient`'s support is only the client half of the XSRF protection scheme.* Your backend service must be configured to set the cookie for your page, and to verify that the header is present on all eligible requests. If not, Angular's default protection will be ineffective.", "translation": "*注意,`HttpClient`支持的只是 XSRF 防护方案的客户端这一半。* 我们的后端服务必须配置为给页面设置 cookie ,并且要验证请求头,以确保全都是合法的请求。否则,Angular 默认的这种防护措施就会失效。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/http.md" }, @@ -11960,7 +12085,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/i18n.md" }, { - "original": "This syntax conforms to the\nICU Message Format\nthat derives from the\nCommon Locale Data Repository (CLDR),\nwhich specifies the\npluralization rules.", + "original": "that derives from the\nCommon Locale Data Repository (CLDR),\nwhich specifies the\npluralization rules.", "translation": "这个写法符合ICU消息格式,它源自通用区域设置数据库(CLDR),其中指定了复数规则。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/i18n.md" }, @@ -12130,7 +12255,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/i18n.md" }, { - "original": "
\nNote that the translation unit `id=introductionHeader` is derived from the [_custom_ `id`](#custom-id \"Set a custom id\") that you set earlier, but **without the `@@` prefix** required in the source HTML.", + "original": "Note that the translation unit `id=introductionHeader` is derived from the [_custom_ `id`](#custom-id \"Set a custom id\") that you set earlier, but **without the `@@` prefix** required in the source HTML.", "translation": "注意,翻译单元`id=introductionHeader`派生自[*自定义*`id`](#custom-id \"设置自定义id\"),它设置起来更简单,但是在HTML源码中**不需要`@@`前缀**。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/i18n.md" }, @@ -12309,16 +12434,6 @@ "translation": "JiT(即时)编译器在应用程序加载时,在浏览器中编译应用。\n在使用JiT编译器的环境中翻译是一个动态的流程,包括:", "sourceFile": "/Users/twer/private/GDE/content-1/guide/i18n.md" }, - { - "original": "JiT(即时)编译器在应用程序加载时,在浏览器中编译应用。\n在使用JiT编译器的环境中翻译是一个动态的流程,包括:", - "translation": "1. Determining the language version for the current user。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/i18n.md" - }, - { - "original": "1. Determining the language version for the current user。", - "translation": "决定当前用户的语言,", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/i18n.md" - }, { "original": "2. Importing the appropriate language translation file as a string constant.", "translation": "导入合适的语言翻译文件到一个字符串常量,", @@ -12805,13 +12920,13 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/lifecycle-hooks.md" }, { - "original": "\n

Hook\n

", - "translation": "

\n 钩子\n

", + "original": "

", + "translation": "

\n 钩子", "sourceFile": "/Users/twer/private/GDE/content-1/guide/lifecycle-hooks.md" }, { - "original": "\n

Purpose and Timing\n

", - "translation": "

\n 目的和时机\n

\n \n \n \n ngOnChanges()\n \n ", + "original": "

", + "translation": "

\n 目的和时机", "sourceFile": "/Users/twer/private/GDE/content-1/guide/lifecycle-hooks.md" }, { @@ -12980,13 +13095,13 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/lifecycle-hooks.md" }, { - "original": "\n

Component\n

", - "translation": "

\n 组件\n

", + "original": "

", + "translation": "

\n 组件", "sourceFile": "/Users/twer/private/GDE/content-1/guide/lifecycle-hooks.md" }, { - "original": "\n

Description\n

", - "translation": "

\n 描述\n

\n \n \n \n Peek-a-boo\n \n ", + "original": "

", + "translation": "

\n 描述", "sourceFile": "/Users/twer/private/GDE/content-1/guide/lifecycle-hooks.md" }, { @@ -13025,8 +13140,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/lifecycle-hooks.md" }, { - "original": "

\n Counter\n

", - "translation": "

\n 计数器\n

", + "original": "

", + "translation": "

\n 计数器", "sourceFile": "/Users/twer/private/GDE/content-1/guide/lifecycle-hooks.md" }, { @@ -13985,8 +14100,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

Discussion

", - "translation": "

讨论

", + "original": "Discussion", + "translation": "讨论", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { @@ -14085,7 +14200,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "To demonstrate, run the live example.\nModify the `SharedModule` so that it provides the `UserService` rather than the `CoreModule`.\nThen toggle between the \"Contact\" and \"Heroes\" links a few times.\nThe username goes bonkers as the Angular creates a new `UserService` instance each time.\n", + "original": "", "translation": "自己验证一下吧。\n运行这个在线例子。\n修改`SharedModule`,由它来提供`UserService`而不再由`CoreModule`。\n然后在“Contact”和“Heroes”链接之间切换几次。\n由于Angular每次都创建一个新的`UserService`实例,所以用户名变得不正常了。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, @@ -14405,18 +14520,18 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Feature Module\n

", - "translation": "

\n 特性模块\n

", + "original": "

", + "translation": "

\n 特性模块", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Guidelines\n

", - "translation": "

\n 指导原则\n

", + "original": "

", + "translation": "

\n 指导原则", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "\n {@a domain-feature-module}\n

\n Domain\n

", - "translation": "

\n 领域\n

", + "original": "

", + "translation": "

\n 领域", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { @@ -14460,8 +14575,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "\n {@a routed-feature-module}\n

\n Routed\n

", - "translation": "

\n 路由特性模块\n

", + "original": "

", + "translation": "

\n 路由特性模块", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { @@ -14505,8 +14620,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "\n {@a routing-module}\n

\n Routing\n

", - "translation": "

\n 路由模块\n

", + "original": "

", + "translation": "

\n 路由模块", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { @@ -14580,8 +14695,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "\n {@a service-feature-module}\n

\n Service\n

", - "translation": "

\n 服务\n

", + "original": "

", + "translation": "

\n 服务", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { @@ -14601,12 +14716,12 @@ }, { "original": "Do *not* import service modules in other feature modules.\n If you deviate from this guideline, know what you're doing and why.", - "translation": "*不要*在任何特性模块中导入它们。\n 如果你要违背这条指导原则,请务必想清楚你在做什么,并要有充分的理由。\n ", + "translation": "*不要*在任何特性模块中导入它们。\n 如果你要违背这条指导原则,请务必想清楚你在做什么,并要有充分的理由。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "\n {@a widget-feature-module}\n

\n Widget\n

", - "translation": "

\n 窗口部件\n

", + "original": "

", + "translation": "

\n 窗口部件", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { @@ -14645,173 +14760,153 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Feature Module\n

", - "translation": "

\n 特性模块\n

", + "original": "

", + "translation": "

\n 特性模块", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Declarations\n

", - "translation": "

\n 声明`declarations`\n

", + "original": "

", + "translation": "

\n 声明`declarations`", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Providers\n

", - "translation": "

\n 提供商`providers`\n

", + "original": "

", + "translation": "

\n 提供商`providers`", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Exports\n

", - "translation": "

\n 导出什么\n

", + "original": "

", + "translation": "

\n 导出什么", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Imported By\n

", - "translation": "

\n 被谁导入\n

", + "original": "

", + "translation": "

\n 被谁导入", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Examples\n

", - "translation": "

\n 范例\n

", + "original": "

", + "translation": "

\n 范例", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Domain\n

", - "translation": "

\n 领域\n

", + "original": "

", + "translation": "

\n 领域", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Yes\n

", - "translation": "

\n 有\n

", + "original": "

", + "translation": "

\n 有", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Rare\n

", - "translation": "

\n 罕见\n

", + "original": "

", + "translation": "

\n 罕见", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Top component\n

", - "translation": "

\n 顶级组件\n

", + "original": "

", + "translation": "

\n 顶级组件", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Feature, AppModule\n

", - "translation": "

\n 特性模块和AppModule\n

", + "original": "

", + "translation": "

\n 特性模块和AppModule", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n ContactModule (before routing)\n

", - "translation": "

\n ContactModule(路由之前的那个例子)\n

", + "original": "

", + "translation": "

\n ContactModule(路由之前的那个例子)", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Routed\n

", - "translation": "

\n 路由\n

", + "original": "

", + "translation": "

\n 路由", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Yes\n

", - "translation": "

\n 有\n

", + "original": "

", + "translation": "

\n 有", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Rare\n

", - "translation": "

\n 罕见\n

", + "original": "

", + "translation": "

\n 罕见", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n No\n

", - "translation": "

\n 无\n

", + "original": "

", + "translation": "

\n 无", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Nobody\n

", - "translation": "

\n 无\n

", + "original": "

", + "translation": "

\n 无", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n ContactModule, HeroModule, CrisisModule\n

", - "translation": "

\n ContactModuleHeroModuleCrisisModule\n

", + "original": "

", + "translation": "

\n 路由", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Routing\n

", - "translation": "

\n 路由\n

", + "original": "

", + "translation": "

\n 无", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n No\n

", - "translation": "

\n 无\n

", + "original": "

", + "translation": "

\n 有", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Yes\n

", - "translation": "

\n 有\n

", + "original": "

", + "translation": "

\n 无", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n No\n

", - "translation": "

\n 无\n

", + "original": "

", + "translation": "

\n 服务", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n HttpModule, CoreModule\n

", - "translation": "

\n HttpModuleCoreModule\n

", + "original": "

", + "translation": "

\n 无", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Service\n

", - "translation": "

\n 服务\n

", + "original": "

", + "translation": "

\n 有", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n No\n

", - "translation": "

\n 无\n

", + "original": "

", + "translation": "

\n 无", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Yes\n

", - "translation": "

\n 有\n

", + "original": "

", + "translation": "

\n 窗口部件", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n No\n

", - "translation": "

\n 无\n

", + "original": "

", + "translation": "

\n 有", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n HttpModule, CoreModule\n

", - "translation": "

\n HttpModuleCoreModule\n

", + "original": "

", + "translation": "

\n 罕见", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Widget\n

", - "translation": "

\n 窗口部件\n

", + "original": "

", + "translation": "

\n 有", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Yes\n

", - "translation": "

\n 有\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" - }, - { - "original": "

\n Rare\n

", - "translation": "

\n 罕见\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" - }, - { - "original": "

\n Yes\n

", - "translation": "

\n 有\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" - }, - { - "original": "

\n Feature\n

", - "translation": "

\n 特性模块\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" - }, - { - "original": "

\n CommonModule, SharedModule\n

", - "translation": "

\n CommonModuleSharedModule\n

", + "original": "

", + "translation": "

\n 特性模块", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { @@ -14875,7 +14970,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "The NgModule is also special in another way.\nUnlike JavaScript modules, an NgModule can extend the _entire_ application with services\nby adding providers to the `@NgModule.providers` list.\n", + "original": "", "translation": "Angular模块还有些别的特殊之处。\n不同于JavaScript模块,Angular模块可以通过把服务提供商添加到`@NgModule.providers`数组中来扩展*整个*应用提供的服务。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, @@ -14965,13 +15060,13 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Property\n

", - "translation": "

\n 属性\n

", + "original": "

", + "translation": "

\n 属性", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { - "original": "

\n Description\n

", - "translation": "

\n 描述\n

", + "original": "

", + "translation": "

\n 描述", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { @@ -15146,7 +15241,7 @@ }, { "original": "Both are advanced techniques that few developers ever employ.\n If you are one of those few, you must add these components to the\n `entryComponents` list yourself, either programmatically or by hand.", - "translation": "所有这些高级技巧是只有极少数开发人员才会去用的。\n 如果你是其中的一位,那么你就不得不自行把这些组件添加到`entryComponents`列表中 —— 无论是用程序添加还是手动添加。\n ", + "translation": "所有这些高级技巧是只有极少数开发人员才会去用的。\n 如果你是其中的一位,那么你就不得不自行把这些组件添加到`entryComponents`列表中 —— 无论是用程序添加还是手动添加。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule-faq.md" }, { @@ -15240,7 +15335,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "", + "original": "* [NgModule metadata properties](guide/ngmodule#ngmodule-properties \"A technical summary of the @NgModule metadata properties\")\n CF: This link goes to the top of this page. I would expect it to go to an \"NgModule metadata properties\"\n section at the end of this page, but that section doesn't exist. -->", "translation": "", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, @@ -15620,8 +15715,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "

Add the _ContactComponent_

", - "translation": "

添加 _ContactComponent_

", + "original": "Add the _ContactComponent_", + "translation": "添加 _ContactComponent_", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { @@ -15635,12 +15730,12 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "

Angular form styles

", + "original": "Angular form styles", "translation": "### Angular 表单的风格", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "You can write Angular form components in\ntemplate-driven or\n[reactive](guide/dynamic-form) style.\n", + "original": "", "translation": "我们写 Angular 表单组件时,可以使用[_模板驱动式表单_](guide/forms),\n 也可以使用[_响应式表单_](guide/dynamic-form)。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, @@ -15690,13 +15785,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "

Import the FormsModule

", - "translation": "

导入 FormsModule

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" - }, - { - "original": "

导入 FormsModule

", - "translation": "### 导入`FormsModule`", + "original": "Import the FormsModule", + "translation": "导入 FormsModule", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { @@ -15725,7 +15815,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "

Declare the contact component, directive, and pipe

", + "original": "Declare the contact component, directive, and pipe", "translation": "### 声明联系人的组件、指令和管道", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, @@ -15750,8 +15840,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "

Provide the _ContactService_

", - "translation": "

提供 _ContactService_

", + "original": "Provide the _ContactService_", + "translation": "提供 _ContactService_", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { @@ -15775,8 +15865,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "

Application-scoped providers

", - "translation": "

全应用范围的提供商

", + "original": "Application-scoped providers", + "translation": "全应用范围的提供商", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { @@ -15810,8 +15900,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "

Run the app

", - "translation": "

运行该应用

", + "original": "Run the app", + "translation": "运行该应用", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { @@ -15960,7 +16050,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "### Make _Contact_ a feature module\n", + "original": "", "translation": "### 把_联系人_做成特性模块", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, @@ -16150,7 +16240,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "Examine and download the complete source for this version from the\nlive example.", + "original": "live example.", "translation": "到在线例子\n试用并下载当前版本的完整代码。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, @@ -16200,7 +16290,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "Some file names bear a `.3` extension that indicates\na difference with prior or future versions.\nThe significant differences will be explained in due course.\n", + "original": "", "translation": "有些文件名带有`.3`扩展名,用来和以前/以后的版本区分开。\n我们会在适当的时机解释它们的差异。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, @@ -16374,11 +16464,6 @@ "translation": "`CrisisModule`和本模块非常像,我们不再赘述。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, - { - "original": "`CrisisModule`和本模块非常像,我们不再赘述。", - "translation": "试试在线例子。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" - }, { "original": "## Shared modules", "translation": "## 共享模块", @@ -16570,8 +16655,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { - "original": "

Why bother?

", - "translation": "

没必要?

", + "original": "Why bother?", + "translation": "没必要?", "sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md" }, { @@ -16830,7 +16915,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/npm-packages.md" }, { - "original": "\nGet them now if they're not already installed on your machine.", + "original": "Get them now if they're not already installed on your machine.", "translation": "如果你的电脑上还没有装过,请立即获取它!", "sourceFile": "/Users/twer/private/GDE/content-1/guide/npm-packages.md" }, @@ -17029,11 +17114,6 @@ "translation": "***[concurrently](https://www.npmjs.com/package/concurrently)*** - 一个用来在OS/X、Windows和Linux操作系统上同时运行多个*npm*命令的工具\n***[lite-server](https://www.npmjs.com/package/lite-server)*** : \nA light-weight, static file server, by [John Papa](http://johnpapa.net/) \nwith excellent support for Angular apps that use routing.", "sourceFile": "/Users/twer/private/GDE/content-1/guide/npm-packages.md" }, - { - "original": "***[concurrently](https://www.npmjs.com/package/concurrently)*** - 一个用来在OS/X、Windows和Linux操作系统上同时运行多个*npm*命令的工具\n***[lite-server](https://www.npmjs.com/package/lite-server)*** : \nA light-weight, static file server, by [John Papa](http://johnpapa.net/) \nwith excellent support for Angular apps that use routing.", - "translation": "***[lite-server](https://www.npmjs.com/package/lite-server)*** - 一个轻量级、静态的服务器,\n由[John Papa](http://johnpapa.net/)开发和维护。对使用到路由的Angular程序提供了很好的支持。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/npm-packages.md" - }, { "original": "***[typescript](https://www.npmjs.com/package/typescript)*** : \nthe TypeScript language server, including the *tsc* TypeScript compiler.", "translation": "***[typescript](https://www.npmjs.com/package/typescript)*** - TypeScript语言的服务器,包含了TypeScript编译器*tsc*。", @@ -17094,11 +17174,6 @@ "translation": "在`dependencies`和`peerDependencies`之间的区别大致是这样的:", "sourceFile": "/Users/twer/private/GDE/content-1/guide/npm-packages.md" }, - { - "original": "在`dependencies`和`peerDependencies`之间的区别大致是这样的:", - "translation": ">A **dependency** says, \"I need this thing directly available to *me*.\"\n>\n>**dependency**说:“我需要这东西*对我*是直接可用的。”\n>\n>A **peerDependency** says, \"If you want to use me, you need this thing available to *you*.\"\n>\n>**peerDependency**说:“如果你想使用我,你得先确保这东西*对你*是可用的”", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/npm-packages.md" - }, { "original": "The Angular `package.json` specifies several *peer dependency* packages, \neach pinned to a particular version of a third-party package.", "translation": "Angular就存在这个问题。\n因此,Angular的`package.json`中指定了一系列*平级依赖*包,\n把每个第三方包都固定在一个特定的版本上。", @@ -17204,11 +17279,6 @@ "translation": "在这个插值表达式中,我们让组件的`birthday`值通过[管道操作符](guide/template-syntax#pipe)( | )流动到\n右侧的[Date管道](api/common/DatePipe)函数中。所有管道都会用这种方式工作。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, - { - "original": "在这个插值表达式中,我们让组件的`birthday`值通过[管道操作符](guide/template-syntax#pipe)( | )流动到\n右侧的[Date管道](api/common/DatePipe)函数中。所有管道都会用这种方式工作。", - "translation": "在这个插值表达式中,我们让组件的`birthday`值通过[管道操作符](guide/template-syntax#pipe)( | )流动到\n右侧的[Date管道](api/common/DatePipe)函数中。所有管道都会用这种方式工作。", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" - }, { "original": "## Built-in pipes", "translation": "## 内置的管道", @@ -17355,8 +17425,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { - "original": "
\n Remember the declarations array\n
", - "translation": "
\n 别忘了`declarations`数组\n
", + "original": "
", + "translation": "
\n 别忘了`declarations`数组", "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { @@ -17390,8 +17460,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { - "original": "

No pipe

", - "translation": "

无管道

", + "original": "No pipe", + "translation": "无管道", "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { @@ -17410,8 +17480,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { - "original": "

FlyingHeroesPipe

", - "translation": "

“会飞的英雄”管道(FlyingHeroesPipe)

", + "original": "FlyingHeroesPipe", + "translation": "“会飞的英雄”管道(FlyingHeroesPipe)", "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { @@ -17485,8 +17555,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { - "original": "

Pure pipes

", - "translation": "

纯管道

", + "original": "Pure pipes", + "translation": "纯管道", "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { @@ -17515,7 +17585,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { - "original": "

Impure pipes

", + "original": "Impure pipes", "translation": "### 非纯管道", "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, @@ -17530,7 +17600,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { - "original": "

An impure FlyingHeroesPipe

", + "original": "An impure FlyingHeroesPipe", "translation": "### 非纯版本的*FlyingHeroesPipe*", "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, @@ -17560,8 +17630,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { - "original": "{@a async-pipe}\n

The impure AsyncPipe

", - "translation": "

\n 非纯 AsyncPipe\n

", + "original": "The impure AsyncPipe", + "translation": "

\n 非纯 AsyncPipe", "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { @@ -17585,8 +17655,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { - "original": "

An impure caching pipe

", - "translation": "

一个非纯而且带缓存的管道

", + "original": "An impure caching pipe", + "translation": "一个非纯而且带缓存的管道", "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { @@ -17640,8 +17710,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { - "original": "
\n Debugging with the json pipe\n
", - "translation": "
\n 借助json管道进行调试\n
", + "original": "
", + "translation": "
\n 借助json管道进行调试", "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { @@ -17650,7 +17720,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, { - "original": "

Pure pipes and pure functions

", + "original": "Pure pipes and pure functions", "translation": "### 纯管道与纯函数", "sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md" }, @@ -17760,8 +17830,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { - "original": "

\n Step 1. Set up the Development Environment\n

", - "translation": "

\n 步骤1. 设置开发环境\n

", + "original": "", + "translation": "

\n 步骤1. 设置开发环境", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { @@ -17785,8 +17855,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { - "original": "

\n Step 2. Create a new project\n

", - "translation": "

\n 步骤2. 创建新项目\n

", + "original": "", + "translation": "

\n 步骤2. 创建新项目", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { @@ -17805,8 +17875,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { - "original": "

\n Step 3: Serve the application\n

", - "translation": "

\n 步骤3. 启动开发服务器\n

", + "original": "", + "translation": "

\n 步骤3. 启动开发服务器", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { @@ -17830,8 +17900,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { - "original": "

\n Step 4: Edit your first Angular component\n

", - "translation": "

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

", + "original": "", + "translation": "

\n 步骤4. 编辑我们的第一个Angular组件", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { @@ -17910,12 +17980,12 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { - "original": "\n \n \n \n \n \n \n \n \n \n \n \n
\n File", + "original": "\n File", "translation": "文件", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { - "original": "\n Purpose", + "original": "\n Purpose", "translation": "用途", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, @@ -17931,7 +18001,7 @@ }, { "original": "A folder where you can put images and anything else to be copied wholesale\n when you build your application.", - "translation": "这个文件夹下你可以放图片等任何东西,在构建应用时,它们全都会拷贝到发布包中。\n \n
", + "translation": "这个文件夹下你可以放图片等任何东西,在构建应用时,它们全都会拷贝到发布包中。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { @@ -17941,7 +18011,7 @@ }, { "original": "Every site wants to look good on the bookmark bar.\n Get started with your very own Angular icon.", - "translation": "每个网站都希望自己在书签栏中能好看一点。\n 请把它换成你自己的图标。\n
", + "translation": "每个网站都希望自己在书签栏中能好看一点。\n 请把它换成你自己的图标。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { @@ -17985,12 +18055,12 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { - "original": "\n \n \n \n \n \n \n ", + "translation": "如果用户*尚未*改变过这个控件的值,则为`true`。它总是与`myControl.dirty`相反。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/reactive-forms.md" }, { @@ -19575,23 +19640,23 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "
\n File", + "original": "\n File", "translation": "文件", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, { - "original": "\n Purpose", + "original": "\n Purpose", "translation": "用途", "sourceFile": "/Users/twer/private/GDE/content-1/guide/quickstart.md" }, @@ -18685,33 +18755,28 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/reactive-forms.md" }, { - "original": "

\n Property\n

", - "translation": "

\n 属性\n

", + "original": "

", + "translation": "

\n 属性", "sourceFile": "/Users/twer/private/GDE/content-1/guide/reactive-forms.md" }, { - "original": "

\n Description\n

", - "translation": "

\n 说明\n

", + "original": "

", + "translation": "

\n 说明", "sourceFile": "/Users/twer/private/GDE/content-1/guide/reactive-forms.md" }, { "original": "the value of a `FormControl`.", - "translation": "`FormControl`的值。\n ", + "translation": "`FormControl`的值。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/reactive-forms.md" }, { "original": "the validity of a `FormControl`. Possible values: `VALID`,\n `INVALID`, `PENDING`, or `DISABLED`.", - "translation": "`FormControl`的有效性。可能的值有`VALID`、`INVALID`、`PENDING`或`DISABLED`。\n ", + "translation": "`FormControl`的有效性。可能的值有`VALID`、`INVALID`、`PENDING`或`DISABLED`。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/reactive-forms.md" }, { "original": "`true` if the user has _not_ changed the value in the UI.\n Its opposite is `myControl.dirty`.", - "translation": "如果用户*尚未*改变过这个控件的值,则为`true`。它总是与`myControl.dirty`相反。\n ", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/reactive-forms.md" - }, - { - "original": "

", - "translation": "`true` if the control user has not yet entered the HTML control\n and triggered its blur event. Its opposite is `myControl.touched`.\n 如果用户尚未进入这个HTML控件,也没有触发过它的`blur`(失去焦点)事件,则为`true`。\n 它是`myControl.touched`的反义词。\n
\n \n ", + "original": "Property", + "translation": "属性", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { "original": "\n ", + "translation": "描述", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { "original": "An `Observable` of the route path(s), represented as an array of strings for each part of the route path.", - "translation": "路由路径的`Observable`对象,是一个由路由路径中的各个部分组成的字符串数组。\n \n ", + "translation": "路由路径的`Observable`对象,是一个由路由路径中的各个部分组成的字符串数组。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { "original": "An `Observable` that contains the `data` object provided for the route. Also contains any resolved values from the [resolve guard](#resolve-guard).", - "translation": "一个`Observable`,其中包含提供给路由的`data`对象。也包含由[解析守卫(resolve guard)](#resolve-guard)解析而来的值。\n \n ", + "translation": "一个`Observable`,其中包含提供给路由的`data`对象。也包含由[解析守卫(resolve guard)](#resolve-guard)解析而来的值。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { @@ -19606,7 +19671,7 @@ }, { "original": "The name of the `RouterOutlet` used to render the route. For an unnamed outlet, the outlet name is _primary_.", - "translation": "要把该路由渲染到的`RouterOutlet`的名字。对于无名路由,它的路由名是`primary`,而不是空串。\n \n ", + "translation": "要把该路由渲染到的`RouterOutlet`的名字。对于无名路由,它的路由名是`primary`,而不是空串。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { @@ -19616,7 +19681,7 @@ }, { "original": "The route's parent `ActivatedRoute` when this route is a [child route](#child-routing-component).", - "translation": "当该路由是一个[子路由](#child-routing-component)时,表示该路由的父级`ActivatedRoute`。\n \n ", + "translation": "当该路由是一个[子路由](#child-routing-component)时,表示该路由的父级`ActivatedRoute`。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { @@ -19655,7 +19720,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "
\n Property", - "translation": "属性\n \n Description", - "translation": "描述\n
\n \n ", + "original": "

", + "translation": "

\n 一个带有RouterOutlet的Angular组件,它根据路由器的导航来显示相应的视图。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { @@ -20030,7 +20040,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "The router uses the browser's\nhistory.pushState\nfor navigation. Thanks to `pushState`, you can make in-app URL paths look the way you want them to\nlook, e.g. `localhost:3000/crisis-center`. The in-app URLs can be indistinguishable from server URLs.", + "original": "for navigation. Thanks to `pushState`, you can make in-app URL paths look the way you want them to\nlook, e.g. `localhost:3000/crisis-center`. The in-app URLs can be indistinguishable from server URLs.", "translation": "路由器使用浏览器的history.pushState进行导航。\n感谢`pushState`!有了它,我们就能按所期望的样子来显示应用内部的URL路径,比如:`localhost:3000/crisis-center`。虽然我们使用的全部是客户端合成的视图,但应用内部的这些URL看起来和来自服务器的没有什么不同。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, @@ -20925,23 +20935,23 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n Router Event", + "original": "Router Event", "translation": "路由器事件", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, @@ -19720,123 +19785,68 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n Router Part\n

", - "translation": "

\n 路由器部件\n

", + "original": "

", + "translation": "

\n 路由器部件", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n Meaning\n

", - "translation": "

\n 含义\n

", + "original": "

", + "translation": "

\n 含义", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n Router\n

", - "translation": "

\n Router(路由器)\n

", + "original": "

", + "translation": "

\n 为激活的URL显示应用组件。管理从一个组件到另一个组件的导航", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n Displays the application component for the active URL.\n Manages navigation from one component to the next.\n

", - "translation": "

\n 为激活的URL显示应用组件。管理从一个组件到另一个组件的导航\n

", + "original": "

", + "translation": "

\n 一个独立的Angular模块,用于提供所需的服务提供商,以及用来在应用视图之间进行导航的指令。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n RouterModule\n

", - "translation": "

\n RouterModule(路由器模块)\n

", + "original": "

", + "translation": "

\n 定义了一个路由数组,每一个都会把一个URL路径映射到一个组件。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n A separate NgModule that provides the necessary service providers\n and directives for navigating through application views.\n

", - "translation": "

\n 一个独立的Angular模块,用于提供所需的服务提供商,以及用来在应用视图之间进行导航的指令。\n

\n ", + "original": "

", + "translation": "

\n 定义路由器该如何根据URL模式(pattern)来导航到组件。大多数路由都由路径和组件类构成。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n Routes\n

", - "translation": "

\n Routes(路由数组)\n

", + "original": "

", + "translation": "

\n 该指令(<router-outlet>)用来标记出路由器该在哪里显示视图。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n Defines an array of Routes, each mapping a URL path to a component.\n

", - "translation": "

\n 定义了一个路由数组,每一个都会把一个URL路径映射到一个组件。\n

", + "original": "

", + "translation": "

\n 该指令用来把一个可点击的HTML元素绑定到路由。\n 点击带有绑定到字符串链接参数数组routerLink指令的元素就会触发一次导航。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n Route\n

", - "translation": "

\n Route(路由)\n

", + "original": "

", + "translation": "

\n 当HTML元素上或元素内的routerLink变为激活或非激活状态时,该指令为这个HTML元素添加或移除CSS类。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n Defines how the router should navigate to a component based on a URL pattern.\n Most routes consist of a path and a component type.\n

", - "translation": "

\n 定义路由器该如何根据URL模式(pattern)来导航到组件。大多数路由都由路径和组件类构成。\n

", + "original": "

", + "translation": "

\n 为每个路由组件提供提供的一个服务,它包含特定于路由的信息,比如路由参数、静态数据、解析数据、全局查询参数和全局碎片(fragment)。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n RouterOutlet\n

", - "translation": "

\n RouterOutlet(路由出口)\n

", + "original": "

", + "translation": "

\n 路由器的当前状态包含了一棵由程序中激活的路由构成的树。它包含一些用于遍历路由树的快捷方法。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n The directive (<router-outlet>) that marks where the router displays a view.\n

", - "translation": "

\n 该指令(<router-outlet>)用来标记出路由器该在哪里显示视图。\n

", + "original": "

", + "translation": "

\n 这个数组会被路由器解释成一个路由操作指南。我们可以把一个RouterLink绑定到该数组,或者把它作为参数传给Router.navigate方法。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "

\n RouterLink\n

", - "translation": "

\n RouterLink(路由链接)\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "

\n The directive for binding a clickable HTML element to\n a route. Clicking an element with a routerLink directive\n that is bound to a link parameters array triggers a navigation.\n

", - "translation": "

\n 该指令用来把一个可点击的HTML元素绑定到路由。\n 点击带有绑定到字符串链接参数数组routerLink指令的元素就会触发一次导航。\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "

\n RouterLinkActive\n

", - "translation": "

\n RouterLinkActive(活动路由链接)\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "

\n The directive for adding/removing classes from an HTML element when an associated\n routerLink contained on or inside the element becomes active/inactive.\n

", - "translation": "

\n 当HTML元素上或元素内的routerLink变为激活或非激活状态时,该指令为这个HTML元素添加或移除CSS类。\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "

\n ActivatedRoute\n

", - "translation": "

\n ActivatedRoute(激活的路由)\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "

\n A service that is provided to each route component that contains route specific\n information such as route parameters, static data, resolve data, global query params, and the global fragment.\n

", - "translation": "

\n 为每个路由组件提供提供的一个服务,它包含特定于路由的信息,比如路由参数、静态数据、解析数据、全局查询参数和全局碎片(fragment)。\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "

\n RouterState\n

", - "translation": "

\n RouterState(路由器状态)\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "

\n The current state of the router including a tree of the currently activated\n routes together with convenience methods for traversing the route tree.\n

", - "translation": "

\n 路由器的当前状态包含了一棵由程序中激活的路由构成的树。它包含一些用于遍历路由树的快捷方法。\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "

\n Link parameters array\n

", - "translation": "

\n 链接参数数组\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "

\n An array that the router interprets as a routing instruction.\n You can bind that array toa RouterLink or pass the array as an argument to\n the Router.navigate method.\n

", - "translation": "

\n 这个数组会被路由器解释成一个路由操作指南。我们可以把一个RouterLink绑定到该数组,或者把它作为参数传给Router.navigate方法。\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "

\n Routing component\n

", - "translation": "

\n 路由组件\n

", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "
\n

An Angular component with a RouterOutlet that displays views based on router navigations.\n

", - "translation": "

\n 一个带有RouterOutlet的Angular组件,它根据路由器的导航来显示相应的视图。\n

\n
\n \n ", + "original": "Member", + "translation": "成员", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { "original": "\n ", + "translation": "描述", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { "original": "Returns `true` if the parameter name is in the map of parameters.", - "translation": "如果参数名位于参数列表中,就返回 `true` 。\n \n ", + "translation": "如果参数名位于参数列表中,就返回 `true` 。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { "original": "Returns the parameter name value (a `string`) if present, or `null` if the parameter name is not in the map. Returns the _first_ element if the parameter value is actually an array of values.", - "translation": "如果这个map中有参数名对应的参数值(字符串),就返回它,否则返回`null`。如果参数值实际上是一个数组,就返回它的*第一个*元素。\n \n ", + "translation": "如果这个map中有参数名对应的参数值(字符串),就返回它,否则返回`null`。如果参数值实际上是一个数组,就返回它的*第一个*元素。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { @@ -21421,11 +21431,11 @@ }, { "original": "This section shows you how to organize the crisis center\nto conform to the following recommended pattern for Angular applications:", - "translation": "本节会展示如何组织危机中心,来满足Angular应用所推荐的模式:* Each feature area resides in its own folder. 把每个特性放在自己的目录中。\n* Each feature has its own Angular feature module.", + "translation": "本节会展示如何组织危机中心,来满足Angular应用所推荐的模式:* Each feature area resides in its own folder. 把每个特性放在自己的目录中。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "本节会展示如何组织危机中心,来满足Angular应用所推荐的模式:* Each feature area resides in its own folder. 把每个特性放在自己的目录中。\n* Each feature has its own Angular feature module.", + "original": "* Each feature has its own Angular feature module.", "translation": "每个特性都有自己的Angular特性模块。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, @@ -21725,12 +21735,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "第二路由很像主路由,配置方式也一样。它们只有一些关键的不同点:", - "translation": "* They are independent of each other.\n它们彼此互不依赖。* They work in combination with other routes. 它们与其它路由组合使用。\n* They are displayed in named outlets.", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "* They are independent of each other.\n它们彼此互不依赖。* They work in combination with other routes. 它们与其它路由组合使用。\n* They are displayed in named outlets.", + "original": "* They are displayed in named outlets.", "translation": "它们显示在命名出口中。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, @@ -21831,11 +21836,11 @@ }, { "original": "The interesting part of the URL follows the `...`:", - "translation": "这个URL中有意思的部分是`...`后面的这些:* The `crisis-center` is the primary navigation. `crisis-center`是主导航。\n* Parentheses surround the secondary route.", + "translation": "这个URL中有意思的部分是`...`后面的这些:* The `crisis-center` is the primary navigation. `crisis-center`是主导航。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "这个URL中有意思的部分是`...`后面的这些:* The `crisis-center` is the primary navigation. `crisis-center`是主导航。\n* Parentheses surround the secondary route.", + "original": "* Parentheses surround the secondary route.", "translation": "圆括号包裹的部分是第二路由。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, @@ -22870,12 +22875,7 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "但是首先,要对`AppRoutingModule`做少量修改。", - "translation": "1. Import `SelectivePreloadingStrategy` into `AppRoutingModule`.\n把`SelectivePreloadingStrategy`导入到`AppRoutingModule`中。1. Replace the `PreloadAllModules` strategy in the call to `forRoot` with this `SelectivePreloadingStrategy`. 把`PreloadAllModules`策略替换成对`forRoot`的调用,并且传入这个`SelectivePreloadingStrategy`。\n1. Add the `SelectivePreloadingStrategy` strategy to the `AppRoutingModule` providers array so it can be injected \nelsewhere in the app.", - "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" - }, - { - "original": "1. Import `SelectivePreloadingStrategy` into `AppRoutingModule`.\n把`SelectivePreloadingStrategy`导入到`AppRoutingModule`中。1. Replace the `PreloadAllModules` strategy in the call to `forRoot` with this `SelectivePreloadingStrategy`. 把`PreloadAllModules`策略替换成对`forRoot`的调用,并且传入这个`SelectivePreloadingStrategy`。\n1. Add the `SelectivePreloadingStrategy` strategy to the `AppRoutingModule` providers array so it can be injected \nelsewhere in the app.", + "original": "1. Add the `SelectivePreloadingStrategy` strategy to the `AppRoutingModule` providers array so it can be injected \nelsewhere in the app.", "translation": "把`SelectivePreloadingStrategy`策略添加到`AppRoutingModule`的`providers`数组中,以便它可以注入到应用中的任何地方。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, @@ -23215,12 +23215,12 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "While the router uses the \nHTML5 pushState\nstyle by default, you *must* configure that strategy with a **base href**.", + "original": "style by default, you *must* configure that strategy with a **base href**.", "translation": "由于路由器默认使用“HTML 5 pushState”风格,所以我们*必须*用一个**base href**来配置该策略(Strategy)。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, { - "original": "The preferred way to configure the strategy is to add a\n<base href> element\ntag in the `` of the `index.html`.", + "original": "tag in the `` of the `index.html`.", "translation": "配置该策略的首选方式是往`index.html`的``中添加一个[<base href> element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base)标签。", "sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md" }, @@ -23280,8 +23280,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { - "original": "

\nReporting vulnerabilities\n

", - "translation": "

\n举报漏洞\n

", + "original": "", + "translation": "

\n举报漏洞", "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { @@ -23295,8 +23295,8 @@ "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { - "original": "

\nBest practices\n

", - "translation": "

\n最佳实践\n

", + "original": "", + "translation": "

\n最佳实践", "sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md" }, { @@ -23329,11 +23329,6 @@ "translation": "为了防范XSS攻击,我们必须阻止恶意代码进入DOM。比如,如果某个攻击者能骗我们把`

\n Member", - "translation": "成员\n \n Description", - "translation": "描述\n