`消失了。
- There's a new attribute, `forbiddenName`, that is actually a custom validation directive.
It invalidates the control if the user enters "bob" anywhere in the name ([try it](#live-example)).
We discuss [custom validation directives](#custom-validation) later in this cookbook.
- - 添加了一个新属性`forbiddenName`,它实际上是一个自定义验证指令。
+ 添加了一个新属性`forbiddenName`,它实际上是一个自定义验证指令。
如果用户名字中的任何地方输入“bob”,该指令变将控制器标记为无效([试试](#live-example))。
我们在本烹饪书后面介绍了[自定义验证指令](#custom-validation)。
- The `#name` template variable is gone because we no longer refer to the Angular control for this element.
- - 模板变量`#name`消失了,因为我们不再需要为这个元素引用Angular控制器。
+ 模板变量`#name`消失了,因为我们不再需要为这个元素引用Angular控制器。
- - Binding to the new `formErrors.name` property is sufficent to display all name validation error messages.
+ - Binding to the new `formErrors.name` property is sufficent to display all name validation error messages.
- - 绑定到新的`formErrors.name`属性,就可以处理所有名字验证错误信息了。
+ 绑定到新的`formErrors.name`属性,就可以处理所有名字验证错误信息了。
#### Component class
@@ -272,22 +272,22 @@ a#template2
- Angular `@ViewChild` queries for a template variable when you pass it
the name of that variable as a string (`'heroForm'` in this case).
- - Angular的`@ViewChild`使用传入的模板变量的字符串名字(这里是`'heroForm'`),来查询对应的模板变量。
+ Angular的`@ViewChild`使用传入的模板变量的字符串名字(这里是`'heroForm'`),来查询对应的模板变量。
- The `heroForm` object changes several times during the life of the component, most notably when we add a new hero.
We'll have to re-inspect it periodically.
- - `heroForm`对象在组件的生命周期内变化了好几次,最值得注意的是当我们添加一个新英雄时的变化。我们必须定期重新检测它。
+ `heroForm`对象在组件的生命周期内变化了好几次,最值得注意的是当我们添加一个新英雄时的变化。我们必须定期重新检测它。
- Angular calls the `ngAfterViewChecked` [lifecycle hook method](../guide/lifecycle-hooks.html#afterview)
when anything changes in the view.
That's the right time to see if there's a new `heroForm` object.
- - 当视图有任何变化时,Angular调用`ngAfterViewChecked`[生命周期钩子方法](../guide/lifecycle-hooks.html#afterview)。这是查看是否有新`heroForm`对象的最佳时机。
+ 当视图有任何变化时,Angular调用`ngAfterViewChecked`[生命周期钩子方法](../guide/lifecycle-hooks.html#afterview)。这是查看是否有新`heroForm`对象的最佳时机。
- When there _is_ a new `heroForm` model, we subscribe to its `valueChanged` _Observable_ property.
- - 当出现新`heroForm`模型时,我们订阅它的`valueChanged`**可观察**属性。
+ 当出现新`heroForm`模型时,我们订阅它的`valueChanged`**可观察**属性。
The `onValueChanged` handler looks for validation errors after every user keystroke.
@@ -318,19 +318,19 @@ a#template2
- clears the prior error message if any
- - 如果有之前的错误信息,清楚它们
+ 如果有之前的错误信息,清楚它们
- acquires the field's corresponding Angular form control
- - 获取控件对应的Angular表单控制器
+ 获取控件对应的Angular表单控制器
- if such a control exists _and_ its been changed ("dirty") _and_ its invalid ...
- - 如果这样的控制器存在,并且它被更新(“dirty”)**以及**它无效...
+ 如果这样的控制器存在,并且它被更新(“dirty”)**以及**它无效...
- the handler composes a consolidated error message for all of the control's errors.
- - 处理器便为所有控制器的错误合成一条错误消息。
+ 处理器便为所有控制器的错误合成一条错误消息。
We'll need some error messages of course, a set for each validated property, one message per validation rule:
@@ -442,15 +442,15 @@ a#reactive
* add, change, and remove validation functions on the fly
- * 随时添加、修改和删除验证函数
+ 随时添加、修改和删除验证函数
* manipulate the control model dynamically from within the component
- * 在组件内动态操纵控制器模型
+ 在组件内动态操纵控制器模型
* [test](#testing) validation and control logic with isolated unit tests.
- * 使用孤立单元测试来[测试](#testing)验证和控制器逻辑
+ 使用孤立单元测试来[测试](#testing)验证和控制器逻辑
The third cookbook sample re-writes the hero form in _reactive forms_ style.
@@ -507,12 +507,12 @@ a#reactive
- the validation attributes are gone (except `required`) because we'll be validating in code.
- - 验证属性没有了(除了`required`),因为我们将在代码中验证。
+ 验证属性没有了(除了`required`),因为我们将在代码中验证。
- `required` remains, not for validation purposes (we'll cover that in the code),
but rather for css styling and accessibility.
- - 保留了`required`,不是为了验证目的(我们将在代码中再行解释),而是为了CSS样式和可访问性。
+ 保留了`required`,不是为了验证目的(我们将在代码中再行解释),而是为了CSS样式和可访问性。
.l-sub-section
:marked
@@ -530,13 +530,13 @@ a#reactive
- the `formControlName` replaces the `name` attribute; it serves the same
purpose of correlating the input box with the Angular form control.
- - `formControlName`替换了`name`属性;它起到了关联输入框和Angular表单控制器的同样作用。
+ `formControlName`替换了`name`属性;它起到了关联输入框和Angular表单控制器的同样作用。
- the two-way `[(ngModel)]` binding is gone.
The reactive approach does not use data binding to move data into and out of the form controls.
We do that in code.
- - 双向`[(ngModel)]`绑定消失了。
+ 双向`[(ngModel)]`绑定消失了。
响应式表单方法不使用数据绑定从表单控制器移入和移出数据。我们在代码中做这些。
.l-sub-section
@@ -571,12 +571,12 @@ a#reactive
:marked
- we inject the `FormBuilder` in a constructor.
- - 我们注入`FormBuilder`到构造函数中。
+ 我们注入`FormBuilder`到构造函数中。
- we call a `buildForm` method in the `ngOnInit` [lifecycle hook method](../guide/lifecycle-hooks.html#hooks-overview)
because that's when we'll have the hero data. We'll call it again in the `addHero` method.
- - 我们在`ngOnInit`[生命周期钩子方法](../guide/lifecycle-hooks.html#hooks-overview)中调用`buildForm`方法,
+ 我们在`ngOnInit`[生命周期钩子方法](../guide/lifecycle-hooks.html#hooks-overview)中调用`buildForm`方法,
因为这正是我们拥有英雄数据的时刻。我们将在`addHero`方法中再次调用它。
.l-sub-section
@@ -590,7 +590,7 @@ a#reactive
to the form's `valueChanged` event and calls it immediately
to set error messages for the new control model.
- - `buildForm`方法使用`FormBuilder`(`fb`)来声明表单控制器模型。
+ `buildForm`方法使用`FormBuilder`(`fb`)来声明表单控制器模型。
然后它将相同的`onValueChanged`(有一行代码不一样)处理器附加到表单的`valueChanged`事件,
并立刻为新的控制器模型设置错误消息。
@@ -646,11 +646,11 @@ a#reactive
1. when the user submits the form
- 1. 当用户提交标单时
+ 当用户提交标单时
1. when the user chooses to add a new hero
- 1. 当用户选择添加新英雄
+ 当用户选择添加新英雄
The `onSubmit` method simply replaces the `hero` object with the combined values of the form:
diff --git a/public/docs/ts/latest/cookbook/i18n.jade b/public/docs/ts/latest/cookbook/i18n.jade
index d9fa5b5bac..382a0c77ef 100644
--- a/public/docs/ts/latest/cookbook/i18n.jade
+++ b/public/docs/ts/latest/cookbook/i18n.jade
@@ -92,22 +92,22 @@ a#angular-i18n
1. Mark static text messages in your component templates for translation.
- 1. 在组件模板中标记需要翻译的静态文本信息。
+ 在组件模板中标记需要翻译的静态文本信息。
1. An angular _i18n_ tool extracts the marked messages into an industry standard translation source file.
- 1. Angular的_i18n_工具将标记的信息提取到一个行业标准的翻译源文件。
+ Angular的_i18n_工具将标记的信息提取到一个行业标准的翻译源文件。
1. A translator edits that file, translating the extracted text messages into the target language,
and returns the file to you.
- 1. 翻译人员编辑该文件,翻译提取出来的文本信息到目标语言,并将该文件还给你。
+ 翻译人员编辑该文件,翻译提取出来的文本信息到目标语言,并将该文件还给你。
1. The Angular compiler imports the completed translation files,
replaces the original messages with translated text, and generates a new version of the application
in the target language.
- 1. Angular编译器导入完成翻译的文件,使用翻译的文本替换原始信息,并生成新的目标语言版本的应用程序。
+ Angular编译器导入完成翻译的文件,使用翻译的文本替换原始信息,并生成新的目标语言版本的应用程序。
You need to build and deploy a separate version of the application for each supported language.
@@ -556,16 +556,16 @@ a#merge
* the translation file
- * 翻译文件
+ 翻译文件
* the translation file format
- * 翻译文件的格式
+ 翻译文件的格式
* the
_Locale ID_
(`es` or `en-US` for instance)
- * 目标
_语言环境ID_
+ 目标
_语言环境ID_
(例如`es`或`en-US`)
_How_ you provide this information depends upon whether you compile with
@@ -575,11 +575,11 @@ a#merge
* With [JIT](#jit), you provide the information at bootstrap time.
- * 使用[JiT](#jit)时,在引导时提供
+ 使用[JiT](#jit)时,在引导时提供
* With [AOT](#aot), you pass the information as `ngc` options.
- * 使用[AoT](#aot)时,在`ngc`命令的选项里提供
+ 使用[AoT](#aot)时,在`ngc`命令的选项里提供
a#jit
.l-main-section
@@ -663,7 +663,7 @@ a#text-plugin
* `LOCALE_ID` is the locale of the target language.
- * `LOCALE_ID`是目标语言的语言环境。
+ `LOCALE_ID`是目标语言的语言环境。
The `getTranslationProviders` function in the following `src/app/i18n-providers.ts`
creates those providers based on the user's _locale_
diff --git a/public/docs/ts/latest/cookbook/ngmodule-faq.jade b/public/docs/ts/latest/cookbook/ngmodule-faq.jade
index b678cf4501..64f248ec88 100644
--- a/public/docs/ts/latest/cookbook/ngmodule-faq.jade
+++ b/public/docs/ts/latest/cookbook/ngmodule-faq.jade
@@ -27,92 +27,151 @@ block includes
声明(declarations)
* [What classes should I add to _declarations_?](#q-what-to-declare)
- * [我应该把哪些类加到_declarations_中?](#q-what-to-declare)
+
+ [我应该把哪些类加到_declarations_中?](#q-what-to-declare)
+
* [What is a _declarable_?](#q-declarable)
- * [什么是*可声明的*?](#q-declarable)
+
+ [什么是*可声明的*?](#q-declarable)
+
* [What classes should I *not* add to _declarations_?](#q-what-not-to-declare)
- * [我*不应该*把哪些类加到_declarations_中?](#q-what-not-to-declare)
+
+ [我*不应该*把哪些类加到_declarations_中?](#q-what-not-to-declare)
+
* [Why list the same component in multiple _NgModule_ properties?](#q-why-multiple-mentions)
- * [为什么要把同一个组件列在*NgModule*的不同属性中?](#q-why-multiple-mentions)
+
+ [为什么要把同一个组件列在*NgModule*的不同属性中?](#q-why-multiple-mentions)
+
* [What does "_Can't bind to 'x' since it isn't a known property of 'y'_" mean?](#q-why-cant-bind-to)
- * ["_Can't bind to 'x' since it isn't a known property of 'y'_"是什么意思?](#q-why-cant-bind-to)
+
+ ["_Can't bind to 'x' since it isn't a known property of 'y'_"是什么意思?](#q-why-cant-bind-to)
Imports
导入(imports)
* [What should I import?](#q-what-to-import)
- * [我应该导入什么?](#q-what-to-import)
+
+ [我应该导入什么?](#q-what-to-import)
+
* [Should I import _BrowserModule_ or _CommonModule_?](#q-browser-vs-common-module)
- * [我应该导入_BrowserModule_还是_CommonModule_?](#q-browser-vs-common-module)
+
+ [我应该导入_BrowserModule_还是_CommonModule_?](#q-browser-vs-common-module)
+
* [What if I import the same module twice?](#q-reimport)
- * [如果我两次导入了同一个模块会怎么样?](#q-reimport)
+
+ [如果我两次导入了同一个模块会怎么样?](#q-reimport)
Exports
导出(exports)
* [What should I export?](#q-what-to-export)
- * [我应该导出什么?](#q-what-to-export)
+
+ [我应该导出什么?](#q-what-to-export)
+
* [What should I *not* export?](#q-what-not-to-export)
- * [我*不*应该导出什么?](#q-what-not-to-export)
+
+ [我*不*应该导出什么?](#q-what-not-to-export)
+
* [Can I re-export imported classes and modules?](#q-re-export)
- * [我能再次导出(re-export)所导入的类和模块吗?](#q-re-export)
+
+ [我能再次导出(re-export)所导入的类和模块吗?](#q-re-export)
+
* [What is the _forRoot_ method?](#q-for-root)
- * [_forRoot_方法是什么?](#q-for-root)
+
+ [_forRoot_方法是什么?](#q-for-root)
Service Providers
服务提供商(providers)
* [Why is a service provided in a feature module visible everywhere?](#q-module-provider-visibility)
- * [为什么特性模块中提供的服务是到处可见的?](#q-module-provider-visibility)
+
+ [为什么特性模块中提供的服务是到处可见的?](#q-module-provider-visibility)
+
* [Why is a service provided in a _lazy loaded_ module visible only to that module?](#q-lazy-loaded-module-provider-visibility)
- * [为什么*惰性加载*模块中的服务提供商只对那个模块本身可见?](#q-lazy-loaded-module-provider-visibility)
+
+ [为什么*惰性加载*模块中的服务提供商只对那个模块本身可见?](#q-lazy-loaded-module-provider-visibility)
+
* [What if two modules provide the _same_ service?](#q-module-provider-duplicates)
- * [如果两个模块提供了*同一个*服务会怎样?](#q-module-provider-duplicates)
+
+ [如果两个模块提供了*同一个*服务会怎样?](#q-module-provider-duplicates)
+
* [How do I restrict service scope to a module?](#q-component-scoped-providers)
- * [如何把服务的范围限制在某个模块中?](#q-component-scoped-providers)
+
+ [如何把服务的范围限制在某个模块中?](#q-component-scoped-providers)
+
* [Should I add app-wide providers to the root _AppModule_ or the root _AppComponent_?](#q-root-component-or-module)
- * [我应该把全应用级的提供商添加到根模块*AppModule*还是根组件*AppComponent*?](#q-root-component-or-module)
+
+ [我应该把全应用级的提供商添加到根模块*AppModule*还是根组件*AppComponent*?](#q-root-component-or-module)
+
* [Should I add other providers to a module or a component?](#q-component-or-module)
- * [我应该把其它提供商添加到模块中还是组件中?](#q-component-or-module)
+
+ [我应该把其它提供商添加到模块中还是组件中?](#q-component-or-module)
+
* [Why is it bad if _SharedModule_ provides a service to a lazy loaded module?](#q-why-bad)
- * [为什么让*SharedModule*为惰性加载模块提供服务是个馊主意?](#q-why-bad)
+
+ [为什么让*SharedModule*为惰性加载模块提供服务是个馊主意?](#q-why-bad)
+
* [Why does lazy loading create a child injector?](#q-why-child-injector)
- * [为什么惰性加载模块要创建一个子注入器?](#q-why-child-injector)
+
+ [为什么惰性加载模块要创建一个子注入器?](#q-why-child-injector)
+
* [How can I tell if a module or service was previously loaded?](#q-is-it-loaded)
- * [我要怎样才能知道一个模块或服务已经被加载过?](#q-is-it-loaded)
+
+ [我要怎样才能知道一个模块或服务已经被加载过?](#q-is-it-loaded)
+
Entry Components
入口组件
* [What is an _entry component_?](#q-entry-component-defined)
- * [什么是*入口组件*?](#q-entry-component-defined)
+
+ [什么是*入口组件*?](#q-entry-component-defined)
+
* [What is the difference between a _bootstrap_ component and an _entry component_?](#q-bootstrap_vs_entry_component)
- * [*引导*组件和*入口*组件有什么不同?](#q-bootstrap_vs_entry_component)
+
+ [*引导*组件和*入口*组件有什么不同?](#q-bootstrap_vs_entry_component)
+
* [When do I add components to _entryComponents_?](#q-when-entry-components)
- * [什么情况下我应该把组件添加到*entryComponent*中?](#q-when-entry-components)
+
+ [什么情况下我应该把组件添加到*entryComponent*中?](#q-when-entry-components)
+
* [Why does Angular need _entryComponents_?](#q-why-entry-components)
- * [为什么Angular需要_entryComponents_?](#q-why-entry-components)
+
+ [为什么Angular需要_entryComponents_?](#q-why-entry-components)
+
General
一般问题
* [What kinds of modules should I have and how should I use them?](#q-module-recommendations)
- * [我需要哪些类型的模块?我应该如何使用它们?](#q-module-recommendations)
+
+ [我需要哪些类型的模块?我应该如何使用它们?](#q-module-recommendations)
+
* [What's the difference between Angular and JavaScript Modules?](#q-ng-vs-js-modules)
- * [Angular模块和JavaScript模块有什么不同?](#q-ng-vs-js-modules)
+
+ [Angular模块和JavaScript模块有什么不同?](#q-ng-vs-js-modules)
+
* [What is a "template reference"?](#q-template-reference)
- * [什么是“模板引用”?](#q-template-reference)
+
+ [什么是“模板引用”?](#q-template-reference)
+
* [How does Angular find components, directives, and pipes in a template?](#q-template-reference)
- * [Angular如何是在模板中查找组件、指令和管道的?](#q-template-reference)
+
+ [Angular如何是在模板中查找组件、指令和管道的?](#q-template-reference)
+
* [What is the Angular Compiler?](#q-angular-compiler)
- * [什么是Angular编译器(Compiler)?](#q-angular-compiler)
+
+ [什么是Angular编译器(Compiler)?](#q-angular-compiler)
+
* [Can you summarize the _NgModule_ API?](#q-ngmodule-api)
- * [你能总结一下_NgModule_ API吗?](#q-ngmodule-api)
+
+ [你能总结一下_NgModule_ API吗?](#q-ngmodule-api)
+
.l-hr
@@ -167,26 +226,26 @@ a#q-what-not-to-declare
* a class that is already declared in another module, whether an app module, @angular module, or 3rd party module
- * 已经被其它模块声明过的类,无论是在应用模块、@angular模块还是第三方模块中。
+ 已经被其它模块声明过的类,无论是在应用模块、@angular模块还是第三方模块中。
* an array of directives imported from another module.
For example, do not declare FORMS_DIRECTIVES from `@angular/forms`.
- * 一组从其它模块中导入的指令。
+ 一组从其它模块中导入的指令。
例如,不要声明来自`@angular/forms`的FORMS_DIRECTIVES。
* module classes
- * 模块类
+ 模块类
* service classes
- * 服务类
+ 服务类
* non-Angular classes and objects such as
strings, numbers, functions, entity models, configurations, business logic, and helper classes.
- * 非Angular的类和对象,比如:字符串、数字、函数、实体模型、配置、业务逻辑和辅助类。
+ 非Angular的类和对象,比如:字符串、数字、函数、实体模型、配置、业务逻辑和辅助类。
.l-hr
@@ -209,13 +268,21 @@ a#q-why-multiple-mentions
这*看起来*是多余的,不过这些函数具有不同的功能,我们无法从它出现在一个列表中推断出它也应该在另一个列表中。
* `AppComponent` could be declared in this module but not bootstrapped.
- * `AppComponent`可能被声明在此模块中,但可能不是引导组件。
+
+ `AppComponent`可能被声明在此模块中,但可能不是引导组件。
+
* `AppComponent` could be bootstrapped in this module but declared in a different feature module.
- * `AppComponent`可能在此模块中引导,但可能是由另一个特性模块声明的。
+
+ `AppComponent`可能在此模块中引导,但可能是由另一个特性模块声明的。
+
* `HeroComponent` could be imported from another app module (so we can't declare it) and re-exported by this module.
- * `HeroComponent`可能是从另一个应用模块中导入的(所以我们没法声明它)并且被当前模块重新导出。
+
+ `HeroComponent`可能是从另一个应用模块中导入的(所以我们没法声明它)并且被当前模块重新导出。
+
* `HeroComponent` could be exported for inclusion in an external component's template and also dynamically loaded in a pop-up dialog.
- * `HeroComponent`可能被导入,以便用在外部组件的模板中,但也可能同时被一个弹出式对话框加载。
+
+ `HeroComponent`可能被导入,以便用在外部组件的模板中,但也可能同时被一个弹出式对话框加载。
+
.l-hr
@@ -388,27 +455,27 @@ a#q-what-not-to-export
* Private components, directives, and pipes that you need only within components declared in this module.
If you don't want another module to see it, don't export it.
- * 那些你只想在当前模块中声明的那些组件中使用的私有组件、指令和管道。如果你不希望任何模块看到它,就不要导出。
+ 那些你只想在当前模块中声明的那些组件中使用的私有组件、指令和管道。如果你不希望任何模块看到它,就不要导出。
* Non-declarable objects such as services, functions, configurations, entity models, etc.
- * 不可声明的对象,比如服务、函数、配置、实体模型等。
+ 不可声明的对象,比如服务、函数、配置、实体模型等。
* Components that are only loaded dynamically by the router or by bootstrapping.
Such [entry components](#q-entry-component-defined) can never be selected in another component's template.
There's no harm in exporting them but no benefit either.
- * 那些只被路由器或引导函数动态加载的组件。
- 比如[入口组件](#q-entry-component-defined)可能从来不会在其它组件的模板中出现。
- 导出它们没有坏处,但也没有好处。
+ 那些只被路由器或引导函数动态加载的组件。
+ 比如[入口组件](#q-entry-component-defined)可能从来不会在其它组件的模板中出现。
+ 导出它们没有坏处,但也没有好处。
* Pure service modules that don't have public (exported) declarations.
For example, there is no point in re-exporting `HttpModule` because it doesn't export anything.
It's only purpose is to add http service providers to the application as a whole.
- * 纯服务模块没有公开(导出)的声明。
- 例如,没必要重新导出`HttpModule`,因为它不导出任何东西。
- 它唯一的用途是一起把http的那些服务提供商添加到应用中。
+ 纯服务模块没有公开(导出)的声明。
+ 例如,没必要重新导出`HttpModule`,因为它不导出任何东西。
+ 它唯一的用途是一起把http的那些服务提供商添加到应用中。
.l-hr
@@ -1029,9 +1096,12 @@ a#q-entry-component-defined
Angular会自动把两种组件添加到模块的`entryComponents`中:
1. the component in the `@NgModule.bootstrap` list
- 1. 那些出现在`@NgModule.bootstrap`列表中的组件
+
+ 那些出现在`@NgModule.bootstrap`列表中的组件
+
1. components referenced in router configuration
- 1. 那些被路由定义引用的组件
+
+ 那些被路由定义引用的组件
We don't have to mention these components explicitly although it does not harm to do so.
@@ -1244,13 +1314,21 @@ a#q-module-recommendations
特性模块一般可分成下面这四种:
* [Domain Feature Modules](#domain-feature-module)
- * [领域特性模块](#domain-feature-module)
+
+ [领域特性模块](#domain-feature-module)
+
* [Routing Modules](#routing-module)
- * [路由模块](#routing-module)
+
+ [路由模块](#routing-module)
+
* [Service Feature Modules](#service-feature-module)
- * [服务特性模块](#service-feature-module)
+
+ [服务特性模块](#service-feature-module)
+
* [Widget Feature Modules](#widget-feature-module)
- * [窗口部件特性模块](#widget-feature-module)
+
+ [窗口部件特性模块](#widget-feature-module)
+
.l-sub-section
:marked
@@ -1387,19 +1465,20 @@ table
* defines routes
- * 定义路由
+ 定义路由
* adds router configuration to the module's `imports`
- * 添加路由配置到模块的`imports`中
+ 添加路由配置到模块的`imports`中
* re-exports `RouterModule`
- * 重新导出`RouterModule`
+ 重新导出`RouterModule`
* adds guard and resolver service providers to the module's `providers`.
- * 添加守卫和解析器服务提供商到模块的`providers`。
+ 添加守卫和解析器服务提供商到模块的`providers`。
+
The name of the Routing Module should parallel the name of its companion module, using the suffix "Routing".
For example, `FooModule` in `foo.module.ts` has a routing module named `FooRoutingModule`
@@ -1678,18 +1757,18 @@ code-example(format='.').
1. An Angular module bounds [_declarable classes_](#q-declarables) only.
Declarables are the only classes that matter to the [Angular compiler](#q-angular-compiler).
- 1. Angular模块只绑定了[_可声明的类_](#q-declarables),这些可声明的类只是供[Angular编译器](#q-angular-compiler)用的。
+ Angular模块只绑定了[_可声明的类_](#q-declarables),这些可声明的类只是供[Angular编译器](#q-angular-compiler)用的。
1. Instead of defining all member classes in one giant file (as in a JavaScript module),
we list the module's classes in the `@NgModule.declarations` list.
- 1. JavaScript模块把所有成员类都定义在一个巨型文件,Angular模块则把自己的类都列在`@NgModule.declarations`数组中。
+ JavaScript模块把所有成员类都定义在一个巨型文件,Angular模块则把自己的类都列在`@NgModule.declarations`数组中。
1. An Angular module can only export the [_declarable classes_](#q-declarables)
it owns or imports from other modules.
It doesn't declare or export any other kind of class.
- 1. Angular模块只能导出[_可声明的类_](#q-declarables)。这可能是它自己拥有的也可能是从其它模块中导入的。它不会声明或导出任何其它类型的类。
+ Angular模块只能导出[_可声明的类_](#q-declarables)。这可能是它自己拥有的也可能是从其它模块中导入的。它不会声明或导出任何其它类型的类。
The Angular Module is also special in another way.
Unlike JavaScript modules, an Angular module can extend the _entire_ application with services
@@ -2026,9 +2105,13 @@ table
这样,那些无法自动发现的组件就只剩下两个来源了:
1. Components bootstrapped using one of the imperative techniques.
- 1. 使用某种命令式技巧引导的组件。
+
+ 使用某种命令式技巧引导的组件。
+
1. Components dynamically loaded into the DOM by some means other than the router.
- 1. 使用路由器之外的手段动态加载到DOM中的组件。
+
+ 使用路由器之外的手段动态加载到DOM中的组件。
+
Both are advanced techniques that few developers will ever employ.
If you are one of those few, you'll have to add these components to the
diff --git a/public/docs/ts/latest/cookbook/set-document-title.jade b/public/docs/ts/latest/cookbook/set-document-title.jade
index 4449e0bbb0..1ab174211d 100644
--- a/public/docs/ts/latest/cookbook/set-document-title.jade
+++ b/public/docs/ts/latest/cookbook/set-document-title.jade
@@ -73,12 +73,14 @@ code-example(format='')
[Title](../api/platform/browser/Title-class.html)服务是一个简单的类,提供了一个API,用来获取和设置当前HTML文档的标题。
* `getTitle() : string` — Gets the title of the current HTML document.
-
- * `getTitle(): string` —— 获取当前HTML文档的标题。
+
+ `getTitle(): string` —— 获取当前HTML文档的标题。
+
* `setTitle( newTitle : string )` — Sets the title of the current HTML document.
-
- * `setTitle( newTitle: string)` —— 设置当前HTML文档的标题。
+
+ `setTitle( newTitle: string)` —— 设置当前HTML文档的标题。
+
Let's inject the `Title` service into the root `AppComponent` and expose a bindable `setTitle` method that calls it:
diff --git a/public/docs/ts/latest/cookbook/visual-studio-2015.jade b/public/docs/ts/latest/cookbook/visual-studio-2015.jade
index 30d6431d49..90c8c4975e 100644
--- a/public/docs/ts/latest/cookbook/visual-studio-2015.jade
+++ b/public/docs/ts/latest/cookbook/visual-studio-2015.jade
@@ -46,39 +46,40 @@ include ../_util-fns
- [Prerequisite](#prereq1): Install Node.js
- - [前提条件](#prereq1): 安装Node.js
+ [前提条件](#prereq1): 安装Node.js
- [Prerequisite](#prereq2): Install Visual Studio 2015 Update 3
-
- - [前提条件](#prereq2): 安装Visual Studio 2015 Update 3
+
+ [前提条件](#prereq2): 安装Visual Studio 2015 Update 3
- [Prerequisite](#prereq3): Configure External Web tools
-
- - [前提条件](#prereq3): 配置External Web tools
+
+ [前提条件](#prereq3): 配置External Web tools
- [Prerequisite](#prereq4): Install TypeScript 2 for Visual Studio 2015
-
- - [前提条件](#prereq4): 安装TypeScript 2 for Visual Studio 2015
+
+ [前提条件](#prereq4): 安装TypeScript 2 for Visual Studio 2015
- [Step 1](#download): Download the QuickStart files
- - [第一步](#download): 下载“快速起步”的文件
+ [第一步](#download): 下载“快速起步”的文件
- [Step 2](#create-project): Create the Visual Studio ASP.NET project
- - [第二步](#create-project): 创建Visual Studio ASP.NET项目
+ [第二步](#create-project): 创建Visual Studio ASP.NET项目
- [Step 3](#copy): Copy the QuickStart files into the ASP.NET project folder
- - [第三步](#copy): 把“快速起步”中的文件拷贝到ASP.NET的项目目录中
+ [第三步](#copy): 把“快速起步”中的文件拷贝到ASP.NET的项目目录中
- [Step 4](#restore): Restore required packages
-
- - [第四步](#restore): 恢复需要的包
+
+ [第四步](#restore): 恢复需要的包
- [Step 5](#build-and-run): Build and run the app
- - [第五步](#build-and-run): 构建和运行应用程序
+ [第五步](#build-and-run): 构建和运行应用程序
+
.l-main-section
h2#prereq1 Prerequisite: Node.js
@@ -127,22 +128,26 @@ h2#prereq3 前提条件: 配置External Web tools
* Open the **Options** dialog with `Tools` | `Options`
- * 到`Tools` | `Options`打开**Options**对话框
+ 到`Tools` | `Options`打开**Options**对话框
+
* In the tree on the left, select `Projects and Solutions` | `External Web Tools`.
- * 在左边树型项目中,选择`Projects and Solutions` | `External Web Tools`。
+ 在左边树型项目中,选择`Projects and Solutions` | `External Web Tools`。
+
* On the right, move the `$(PATH)` entry above the `$(DevEnvDir`) entries. This tells Visual Studio to
use the external tools (such as npm) found in the global path before using its own version of the external tools.
* 在右侧,将`$(PATH)`移动到 `$(DevEnvDir`)上面。这样,Visual Stuio就会在使用自带的外部工具时,优先使用全局路径中的外部工具(比如npm)。
- * Click OK to close the dialog.
+ Click OK to close the dialog.
+
* 点击OK关闭对话框。
- * Restart Visual Studio for this change to take effect.
+ Restart Visual Studio for this change to take effect.
+
* 重启Visual Studio,以让设置变化生效。
@@ -168,11 +173,11 @@ h2#prereq4 前提条件: 安装TypeScript 2 for Visual Studio 2015
* Download and install **[TypeScript 2.0 for Visual Studio 2015](http://download.microsoft.com/download/6/D/8/6D8381B0-03C1-4BD2-AE65-30FF0A4C62DA/TS2.0.3-TS-release20-nightly-20160921.1/TypeScript_Dev14Full.exe)**
- * 下载并安装**[TypeScript 2.0 for Visual Studio 2015](http://download.microsoft.com/download/6/D/8/6D8381B0-03C1-4BD2-AE65-30FF0A4C62DA/TS2.0.3-TS-release20-nightly-20160921.1/TypeScript_Dev14Full.exe)**
+ 下载并安装**[TypeScript 2.0 for Visual Studio 2015](http://download.microsoft.com/download/6/D/8/6D8381B0-03C1-4BD2-AE65-30FF0A4C62DA/TS2.0.3-TS-release20-nightly-20160921.1/TypeScript_Dev14Full.exe)**
* OR install it with npm: `npm install -g typescript@2.0`.
- * 或者,通过NPM来安装:`npm install -g typescript@2.0`。
+ 或者,通过NPM来安装:`npm install -g typescript@2.0`。
You can find out more about TypeScript 2 support in Visual studio **[here](https://blogs.msdn.microsoft.com/typescript/2016/09/22/announcing-typescript-2-0/)**
@@ -205,20 +210,24 @@ h2#create-project 第二步:创建Visual Studio ASP.net项目
按照下列步骤创建ASP.NET 4.x项目:
* In Visual Studio, select `File` | `New` | `Project` from the menu.
-
- * 在Visual Studio中,选择`File` | `New` | `Project`菜单。
+
+ 在Visual Studio中,选择`File` | `New` | `Project`菜单。
+
* In the template tree, select `Templates` | `Visual C#` (or `Visual Basic`) | `Web`.
- * 在模板树中,选择`Templates` | `Visual C#`(或`Visual Basic`) | `Web`菜单。
+ 在模板树中,选择`Templates` | `Visual C#`(或`Visual Basic`) | `Web`菜单。
+
* Select the `ASP.NET Web Application` template, give the project a name, and click OK.
- * 选择`ASP.NET Web Application`模板,输入项目名,点击“OK”按钮。
+ 选择`ASP.NET Web Application`模板,输入项目名,点击“OK”按钮。
+
* Select the desired ASP.NET 4.5.2 template and click OK.
- * 选择自己喜欢的ASP.NET 4.5.2模板,点击OK。
+ 选择自己喜欢的ASP.NET 4.5.2模板,点击OK。
+
.l-sub-section
:marked
@@ -240,37 +249,33 @@ h2#copy 第三步: 拷贝“快速起步”的文件到ASP.NET项目所在的目
* Click the `Show All Files` button in Solution Explorer to reveal all of the hidden files in the project.
- * 在Solution Explorer中点击`Show All Files`按钮,显示项目中所有隐藏文件。
+ 在Solution Explorer中点击`Show All Files`按钮,显示项目中所有隐藏文件。
+
* Right-click on each folder/file to be included in the project and select `Include in Project`.
Minimally, include the following folder/files:
- * 右键点击每个目录和文件,选择`Include in Project`。
+ 右键点击每个目录和文件,选择`Include in Project`。
最少要添加下列文件:
* app folder (answer *No* if asked to search for TypeScript Typings)
- * app目录(如果询问是否要搜索TypeScript类型,回答*No*)
+ app目录(如果询问是否要搜索TypeScript类型,回答*No*)
+
* styles.css
- * styles.css
* index.html
- * index.html
* package.json
- * package.json
-
- * tsconfig.json
* tsconfig.json
* typings.json
- * typings.json
.l-main-section
h2#restore Step 4: Restore the required packages
@@ -286,29 +291,30 @@ h2#restore 第四步: 恢复需要的包
This uses `npm` to install all of the packages defined in the `package.json` file.
It may take some time.
- * 在Solution Explorer中右键点击`package.json`,选择`Restore Packages`。
+ 在Solution Explorer中右键点击`package.json`,选择`Restore Packages`。
这样,Visual Studio会使用`npm`来安装在`package.json`中定义的所有包.
这可能需要花一点时间。
* If desired, open the Output window (`View` | `Output`) to watch the npm commands execute.
- * 如果愿意,打开Output窗口(`View` | `Output`)来监控npm命令的执行情况。
+ 如果愿意,打开Output窗口(`View` | `Output`)来监控npm命令的执行情况。
* Ignore the warnings.
- * 忽略所有警告。
+ 忽略所有警告。
* When the restore is finished, a message should say: `npm command completed with exit code 0`.
- * 当恢复完成后,将会出现一条消息:`npm command completed with exit code 0`.
+ 当恢复完成后,将会出现一条消息:`npm command completed with exit code 0`.
* Click the `Refresh` icon in Solution Explorer.
- * 在Solution Explorer里,点击`Refresh`图标。
+ 在Solution Explorer里,点击`Refresh`图标。
* **Do not** include the `node_modules` folder in the project. Let it be a hidden project folder.
- * **不要**将`node_modules`目录添加到项目中,让它隐藏。
+ **不要**将`node_modules`目录添加到项目中,让它隐藏。
+
.l-main-section
h2#build-and-run Step 5: Build and run the app
diff --git a/public/docs/ts/latest/guide/animations.jade b/public/docs/ts/latest/guide/animations.jade
index 1754f9efe2..a987beeb92 100644
--- a/public/docs/ts/latest/guide/animations.jade
+++ b/public/docs/ts/latest/guide/animations.jade
@@ -36,43 +36,43 @@ include ../_util-fns
* [Example: Transitioning between two states](#example-transitioning-between-states)
- * [范例:在两个状态之间进行转场(Transition)](#example-transitioning-between-states)
+ [范例:在两个状态之间进行转场(Transition)](#example-transitioning-between-states)
* [States and transitions](#states-and-transitions)
- * [状态与转场](#states-and-transitions)
+ [状态与转场](#states-and-transitions)
* [Example: Entering and leaving](#example-entering-and-leaving).
-
- * [范例:进场与离场](#example-entering-and-leaving)
+
+ [范例:进场与离场](#example-entering-and-leaving)
* [Example: Entering and leaving from different states](#example-entering-and-leaving-from-different-states).
-
- * [范例:从其它状态进场与离场](#example-entering-and-leaving-from-different-states)
+
+ [范例:从其它状态进场与离场](#example-entering-and-leaving-from-different-states)
* [Animatable properties and units](#animatable-properties-and-units).
- * [可动的(Animatable)属性与单位](#animatable-properties-and-units)
+ [可动的(Animatable)属性与单位](#animatable-properties-and-units)
* [Automatic property calculation](#automatic-property-calculation).
- * [自动属性值计算](#automatic-property-calculation)
+ [自动属性值计算](#automatic-property-calculation)
* [Animation timing](#animation-timing).
- * [动画时间线(Timing)](#animation-timing)
+ [动画时间线(Timing)](#animation-timing)
* [Multi-step animations with keyframes](#multi-step-animations-with-keyframes).
- * [基于关键帧(Keyframes)的多阶段动画](#multi-step-animations-with-keyframes)
+ [基于关键帧(Keyframes)的多阶段动画](#multi-step-animations-with-keyframes)
* [Parallel animation groups](#parallel-animation-groups).
- * [并行动画组(Group)](#parallel-animation-groups)
+ [并行动画组(Group)](#parallel-animation-groups)
* [Animation callbacks](#animation-callbacks).
-
- * [动画回调](#animation-callbacks)
+
+ [动画回调](#animation-callbacks)
.l-sub-section
:marked
@@ -226,11 +226,11 @@ figure.image-display
* The `active => *` transition applies when the element's state changes from `active` to anything else.
- * 当该元素的状态从`active`变成任何其它状态时,`active => *`转场都会生效。
+ 当该元素的状态从`active`变成任何其它状态时,`active => *`转场都会生效。
* The `* => *` transition applies when *any* change between two states takes place.
- * 当在*任意*两个状态之间切换时,`* => *`转场都会生效。
+ 当在*任意*两个状态之间切换时,`* => *`转场都会生效。
figure.image-display
img(src="/resources/images/devguide/animations/ng_animate_transitions_inactive_active_wildcards.png" alt="The wildcard state can be used to match many different transitions at once" width="400")
@@ -276,11 +276,11 @@ figure
* Enter: `void => *`
- * 进场:`void => *`
+ 进场:`void => *`
* Leave: `* => void`
- * 离场:`* => void`
+ 离场:`* => void`
+makeExample('animations/ts/src/app/hero-list-enter-leave.component.ts', 'animationdef')(format=".")
@@ -320,19 +320,19 @@ figure
* Inactive hero enter: `void => inactive`
- * 非激活英雄进场:`void => inactive`
+ 非激活英雄进场:`void => inactive`
* Active hero enter: `void => active`
- * 激活英雄进场:`void => active`
+ 激活英雄进场:`void => active`
* Inactive hero leave: `inactive => void`
- * 非激活英雄离场:`inactive => void`
+ 非激活英雄离场:`inactive => void`
* Active hero leave: `active => void`
- * 激活英雄离场:`active => void`
+ 激活英雄离场:`active => void`
This gives you fine-grained control over each transition:
@@ -373,7 +373,7 @@ figure.image-display
* `50` is the same as saying `'50px'`
- * `50`相当于`'50px'`
+ `50`相当于`'50px'`
## Automatic property calculation
@@ -423,15 +423,15 @@ figure
* As a plain number, in milliseconds: `100`
- * 作为一个普通数字,以毫秒为单位,如:`100`
+ 作为一个普通数字,以毫秒为单位,如:`100`
* In a string, as milliseconds: `'100ms'`
- * 作为一个字符串,以毫秒为单位,如:`'100ms'`
+ 作为一个字符串,以毫秒为单位,如:`'100ms'`
* In a string, as seconds: `'0.1s'`
- * 作为一个字符串,以秒为单位,如:`'0.1s'`
+ 作为一个字符串,以秒为单位,如:`'0.1s'`
### Delay
@@ -445,7 +445,7 @@ figure
* Wait for 100ms and then run for 200ms: `'0.2s 100ms'`
- * 等待100毫秒,然后运行200毫秒:`'0.2s 100ms'`。
+ 等待100毫秒,然后运行200毫秒:`'0.2s 100ms'`。
### Easing
@@ -461,11 +461,11 @@ figure
* Wait for 100ms and then run for 200ms, with easing: `'0.2s 100ms ease-out'`
- * 等待100毫秒,然后运行200毫秒,并且带缓动:`'0.2s 100ms ease-out'`
+ 等待100毫秒,然后运行200毫秒,并且带缓动:`'0.2s 100ms ease-out'`
* Run for 200ms, with easing: `'0.2s ease-in-out'`
- * 运行200毫秒,并且带缓动:`'0.2s ease-in-out'`
+ 运行200毫秒,并且带缓动:`'0.2s ease-in-out'`
figure
img(src="/resources/images/devguide/animations/animation_timings.gif" alt="Animations with specific timings" align="right" style="width:220px;margin-left:20px" )
diff --git a/public/docs/ts/latest/guide/attribute-directives.jade b/public/docs/ts/latest/guide/attribute-directives.jade
index ebd92c81c1..5db7800791 100644
--- a/public/docs/ts/latest/guide/attribute-directives.jade
+++ b/public/docs/ts/latest/guide/attribute-directives.jade
@@ -13,16 +13,27 @@ block includes
# 目录
* [Directives overview](#directive-overview)
+
[指令概览](#directive-overview)
+
* [Build a simple attribute directive](#write-directive)
+
[创建简单的属性型指令](#write-directive)
+
* [Apply the attribute directive to an element in a template](#apply-directive)
+
[应用属性型指令到模板中的元素](#apply-directive)
+
* [Respond to user-initiated events](#respond-to-user)
+
[响应用户引发的事件](#respond-to-user)
+
* [Pass values into the directive with an _@Input_ data binding](#bindings)
+
[使用数据绑定把值传到指令中](#bindings)
+
* [Bind to a second property](#second-property)
+
[绑定第二个属性](#second-property)
@@ -570,13 +581,21 @@ figure.image-display
本章介绍了如何:
- [Build an **attribute directive**](#write-directive) that modifies the behavior of an element.
- [构建一个**属性型指令**](#write-directive),它用于修改一个元素的行为。
+
+ [构建一个**属性型指令**](#write-directive),它用于修改一个元素的行为。
+
- [Apply the directive](#apply-directive) to an element in a template.
- [把一个指令应用到](#apply-directive)模板中的某个元素上。
+
+ [把一个指令应用到](#apply-directive)模板中的某个元素上。
+
- [Respond to **events**](#respond-to-user) that change the directive's behavior.
- [响应**事件**](#respond-to-user)以改变指令的行为。
+
+ [响应**事件**](#respond-to-user)以改变指令的行为。
+
- [**Bind** values to the directive](#bindings).
- [把值**绑定**到指令中](#bindings)。
+
+ [把值**绑定**到指令中](#bindings)。
+
The final source code follows:
diff --git a/public/docs/ts/latest/guide/forms.jade b/public/docs/ts/latest/guide/forms.jade
index 968f44d92f..e03a634b43 100644
--- a/public/docs/ts/latest/guide/forms.jade
+++ b/public/docs/ts/latest/guide/forms.jade
@@ -378,7 +378,7 @@ figure.image-display
This will display the hero form when the application component is loaded.
We've also dropped the `name` field from the class body.
- 1. `template`中只有新元素标签,即组件的`selector`属性。当应用组件被加载时,将显示这个英雄表单。
+ `template`中只有新元素标签,即组件的`selector`属性。当应用组件被加载时,将显示这个英雄表单。
.l-main-section
:marked
diff --git a/public/docs/ts/latest/guide/lifecycle-hooks.jade b/public/docs/ts/latest/guide/lifecycle-hooks.jade
index 0049bbe6ce..883795674c 100644
--- a/public/docs/ts/latest/guide/lifecycle-hooks.jade
+++ b/public/docs/ts/latest/guide/lifecycle-hooks.jade
@@ -42,6 +42,7 @@ figure
* [Interfaces are optional (technically)](#interface-optional)
[接口是可选的(从技术上说)](#interface-optional)
+
* [Other Angular lifecycle hooks](#other-lifecycle-hooks)
[其他Angular生命周期钩子](#other-lifecycle-hooks)
@@ -484,14 +485,14 @@ a#spy
1. Angular calls hook methods for *directives* as well as components.
- 1. 就像对组件一样,Angular也会对*指令*调用这些钩子方法。
+ 就像对组件一样,Angular也会对*指令*调用这些钩子方法。
2. A spy directive can provide insight into a DOM object that you cannot change directly.
Obviously you can't touch the implementation of a native `div`.
You can't modify a third party component either.
But you can watch both with a directive.
- 2. 一个侦探(spy)指令可以让我们在无法直接修改DOM对象实现代码的情况下,透视其内部细节。
+ 一个侦探(spy)指令可以让我们在无法直接修改DOM对象实现代码的情况下,透视其内部细节。
显然,你不能修改一个原生`div`元素的实现代码。
你同样不能修改第三方组件。
但我们用一个指令就能监视它们了。
@@ -547,9 +548,12 @@ figure.image-display
使用`ngOnInit`有两个原因:
1. to perform complex initializations shortly after construction
- 1. 在构造函数之后马上执行复杂的初始化逻辑
+
+ 在构造函数之后马上执行复杂的初始化逻辑
+
1. to set up the component after Angular sets the input properties
- 1. 在Angular设置完输入属性之后,对该组件进行准备。
+
+ 在Angular设置完输入属性之后,对该组件进行准备。
Experienced developers agree that components should be cheap and safe to construct.
@@ -874,12 +878,12 @@ figure.image-display
* The *AfterView* hooks concern `ViewChildren`, the child components whose element tags
appear *within* the component's template.
- * *AfterView*钩子所关心的是`ViewChildren`,这些子组件的元素标签会出现在该组件的模板*里面*。
+ *AfterView*钩子所关心的是`ViewChildren`,这些子组件的元素标签会出现在该组件的模板*里面*。
* The *AfterContent* hooks concern `ContentChildren`, the child components that Angular
projected into the component.
- * *AfterContent*钩子所关心的是`ContentChildren`,这些子组件被Angular投影进该组件中。
+ *AfterContent*钩子所关心的是`ContentChildren`,这些子组件被Angular投影进该组件中。
The following *AfterContent* hooks take action based on changing values in a *content child*
which can only be reached by querying for it via the property decorated with
diff --git a/public/docs/ts/latest/guide/ngmodule.jade b/public/docs/ts/latest/guide/ngmodule.jade
index 7f9eb43d1e..1b157a1f9e 100644
--- a/public/docs/ts/latest/guide/ngmodule.jade
+++ b/public/docs/ts/latest/guide/ngmodule.jade
@@ -922,7 +922,7 @@ a#feature-modules
* The app lacks clear boundaries between contact functionality and other application features.
That lack of clarity makes it harder to assign development responsibilities to different teams.
- * 该应用在联系人和其它特性区之间缺乏清晰的边界。
+ 该应用在联系人和其它特性区之间缺乏清晰的边界。
这种缺失,导致难以在不同的开发组之间分配职责。
We mitigate these problems with _feature modules_.
diff --git a/public/docs/ts/latest/guide/npm-packages.jade b/public/docs/ts/latest/guide/npm-packages.jade
index e081543e71..90be0b9b4c 100644
--- a/public/docs/ts/latest/guide/npm-packages.jade
+++ b/public/docs/ts/latest/guide/npm-packages.jade
@@ -87,13 +87,16 @@ a(id="dependencies")
应用程序的`package.json`文件中,`dependencies`区下有三类包:
* ***Features*** - Feature packages give the application framework and utility capabilities.
- * ***特性*** - 特性包为应用程序提供了框架和工具方面的能力。
+
+ ***特性*** - 特性包为应用程序提供了框架和工具方面的能力。
* ***Polyfills*** - Polyfills plug gaps in the browser's JavaScript implementation.
- * ***填充(Polyfills)*** - 填充包弥合了不同浏览器上的JavaScript实现方面的差异。
+
+ ***填充(Polyfills)*** - 填充包弥合了不同浏览器上的JavaScript实现方面的差异。
* ***Other*** - Other libraries that support the application such as `bootstrap` for HTML widgets and styling.
- * ***其它*** - 其它库对本应用提供支持,比如`bootstrap`包提供了HTML中的小部件和样式。
+
+ ***其它*** - 其它库对本应用提供支持,比如`bootstrap`包提供了HTML中的小部件和样式。
.l-main-section
:marked
diff --git a/public/docs/ts/latest/guide/pipes.jade b/public/docs/ts/latest/guide/pipes.jade
index 1803a9e5fd..2e3a1e01d2 100644
--- a/public/docs/ts/latest/guide/pipes.jade
+++ b/public/docs/ts/latest/guide/pipes.jade
@@ -199,28 +199,28 @@ figure.image-display
* A pipe is a class decorated with pipe metadata.
- * 管道是一个带有“管道元数据(pipe metadata)”装饰器的类。
+ 管道是一个带有“管道元数据(pipe metadata)”装饰器的类。
* The pipe class implements the `PipeTransform` interface's `transform` method that
accepts an input value followed by optional parameters and returns the transformed value.
- * 这个管道类实现了`PipeTransform`接口的`transform`方法,该方法接受一个输入值和一些可选参数,并返回转换后的值。
+ 这个管道类实现了`PipeTransform`接口的`transform`方法,该方法接受一个输入值和一些可选参数,并返回转换后的值。
* There will be one additional argument to the `transform` method for each parameter passed to the pipe.
Our pipe has one such parameter: the `exponent`.
- * 当每个输入值被传给`transform`方法时,还会带上另一个参数,比如我们这个管道中的`exponent`(放大指数)。
+ 当每个输入值被传给`transform`方法时,还会带上另一个参数,比如我们这个管道中的`exponent`(放大指数)。
* We tell Angular that this is a pipe by applying the
`@Pipe` #{_decorator} which we import from the core Angular library.
- * 我们通过`@Pipe`#{_decoratorCn}告诉Angular:这是一个管道。该#{_decoratorCn}是从Angular的`core`库中引入的。
+ 我们通过`@Pipe`#{_decoratorCn}告诉Angular:这是一个管道。该#{_decoratorCn}是从Angular的`core`库中引入的。
* The `@Pipe` #{_decorator} allows us to define the
pipe name that we'll use within template expressions. It must be a valid JavaScript identifier.
Our pipe's name is `exponentialStrength`.
- * 这个`@Pipe`#{_decoratorCn}允许我们定义管道的名字,这个名字会被用在模板表达式中。它必须是一个有效的JavaScript标识符。
+ 这个`@Pipe`#{_decoratorCn}允许我们定义管道的名字,这个名字会被用在模板表达式中。它必须是一个有效的JavaScript标识符。
比如,我们这个管道的名字是`exponentialStrength`。
.l-sub-section
diff --git a/public/docs/ts/latest/guide/router.jade b/public/docs/ts/latest/guide/router.jade
index 658a065303..8b28ebb899 100644
--- a/public/docs/ts/latest/guide/router.jade
+++ b/public/docs/ts/latest/guide/router.jade
@@ -58,125 +58,129 @@ include ../../../_includes/_see-addr-bar
* Setting the [base href](#base-href)
- * 设置[页面的基地址(base href)](#base-href)
+ 设置[页面的基地址(base href)](#base-href)
* Importing from the [router library](#import)
- * 从[路由库](#import)中导入
+ 从[路由库](#import)中导入
* [Configuring the router](#route-config)
- * [配置路由器](#route-config)
+ [配置路由器](#route-config)
* Handling unmatched URLs with a [wildcard route](#wildcard-route)
-
- * 使用[通配符路由](#wildcard-route)处理那些没有匹配上的URL
+
+ 使用[通配符路由](#wildcard-route)处理那些没有匹配上的URL
* The [link parameters array](#link-parameters-array) that propels router navigation
- * 推动路由器导航的[链接参数数组](#link-parameters-array),
+ 推动路由器导航的[链接参数数组](#link-parameters-array),
* Setting the [default route](#default-route) where the application navigates at launch
+
* [Redirecting](#redirect) from one route to another
+
* Navigating when the user clicks a data-bound [RouterLink](#router-link)
- * 在用户点击绑定到数据的[RouterLink](#router-link)时进行导航
+ 在用户点击绑定到数据的[RouterLink](#router-link)时进行导航
* Navigating under [program control](#navigate)
- * 在[程序的控制下](#navigate)进行导航
+ 在[程序的控制下](#navigate)进行导航
* Retrieving information from the [route](#activated-route)
- * 从[当前路由获取信息](#activated-route)
+ 从[当前路由获取信息](#activated-route)
* [Animating](#route-animation) transitions for route components
- * 为路由组件添加转场[动画](#route-animation)
+ 为路由组件添加转场[动画](#route-animation)
* Navigating [relative](#relative-navigation) to the current URL
- * [相对当前URL进行导航](#relative-navigation)
+ [相对当前URL进行导航](#relative-navigation)
* Toggling css classes for the [active router link](#router-link-active)
- * 利用[`router-link-active`指令]切换CSS类(#router-link-active)
+ 利用[`router-link-active`指令]切换CSS类(#router-link-active)
* Embedding critical information in the URL with [route parameters](#route-parameters)
- * 用[路由参数](#route-parameters)把重要信息嵌入URL
+ 用[路由参数](#route-parameters)把重要信息嵌入URL
* Providing non-critical information in [optional route parameters](#optional-route-parameters)
- * 在[可选路由参数](#optional-route-parameters)中提供非关键信息
+ 在[可选路由参数](#optional-route-parameters)中提供非关键信息
* Refactoring routing into a [routing module](#routing-module)
- * 重构路由到[路由模块](#routing-module)
+ 重构路由到[路由模块](#routing-module)
* [Importing routing modules in the proper order](#routing-module-order)
+
* Add [child routes](#child-routing-component) under a feature section
- * 在“特性分区”下添加[子路由](#child-routing-component)
+ 在“特性分区”下添加[子路由](#child-routing-component)
* [Grouping child routes](#component-less-route) without a component
- * 不借助组件[对子路由进行分组](#component-less-route)
+ 不借助组件[对子路由进行分组](#component-less-route)
* Displaying [multiple routes](#named-outlets) in separate outlets
- * 从一个路由[重定向](#redirect)到另一个路由
+ 从一个路由[重定向](#redirect)到另一个路由
* Confirming or canceling navigation with [guards](#guards)
- * 借助[守卫函数](#guards)确认或取消导航
+ 借助[守卫函数](#guards)确认或取消导航
+
* [CanActivate](#can-activate-guard) to prevent navigation to a route
- * 用[CanActivate](#can-activate-guard)阻止导航进某路由
+ 用[CanActivate](#can-activate-guard)阻止导航进某路由
* [CanActivateChild](#can-activate-child-guard) to prevent navigation to a child route
- * 用[CanActivateChild](#can-activate-child-guard)阻止导航进某子路由
+ 用[CanActivateChild](#can-activate-child-guard)阻止导航进某子路由
* [CanDeactivate](#can-deactivate-guard) to prevent navigation away from the current route
- * 用[CanDeactivate](#can-deactivate-guard)阻止离开当前路由的导航
+ 用[CanDeactivate](#can-deactivate-guard)阻止离开当前路由的导航
* [Resolve](#resolve-guard) to pre-fetch data before activating a route
- * 用[Resolve](#resolve-guard)在路由激活之前预先获取数据
+ 用[Resolve](#resolve-guard)在路由激活之前预先获取数据
* [CanLoad](#can-load-guard) to prevent asynchronous routing
- * 用[CanLoad](#can-load-guard)阻止异步路由
+ 用[CanLoad](#can-load-guard)阻止异步路由
* Providing optional information across routes with [query parameters](#query-parameters)
- * 用[查询参数](#query-parameters)提供跨路由的可选信息
+ 用[查询参数](#query-parameters)提供跨路由的可选信息
* Jumping to anchor elements using a [fragment](#fragment)
- * 使用[fragment](#fragment)跳转到其它元素
+ 使用[fragment](#fragment)跳转到其它元素
* Loading feature areas [asynchronously](#asynchronous-routing)
- * [异步](#asynchronous-routing)加载特性分区
+ [异步](#asynchronous-routing)加载特性分区
* Preloading feature areas [during navigation](#preloading)
- * [在导航时](#preloading)预加载特性分区
+ [在导航时](#preloading)预加载特性分区
* Using a [custom strategy](#custom-preloading) to only preload certain features
- * 使用[自定义策略](#custom-preloading)来只预加载指定分区
+ 使用[自定义策略](#custom-preloading)来只预加载指定分区
* [Inspect the router's configuration](#inspect-config).
-
- * [审查路由器的配置](#inspect-config)。
+
+ [审查路由器的配置](#inspect-config)。
* Choosing the "HTML5" or "hash" [URL style](#browser-url-styles)
- * 选择"HTML5"或"hash"[URL风格](#browser-url-styles)
+ 选择"HTML5"或"hash"[URL风格](#browser-url-styles)
.l-main-section
@@ -973,31 +977,31 @@ a#redirect
* load the router library
- * 加载路由库
+ 加载路由库
* add a nav bar to the shell template with anchor tags, `routerLink` and `routerLinkActive` directives
- * 往壳组件的模板中添加一个导航条,导航条中有一些A标签、`routerLink`指令和`routerLinkActive`指令
+ 往壳组件的模板中添加一个导航条,导航条中有一些A标签、`routerLink`指令和`routerLinkActive`指令
* add a `router-outlet` to the shell template where views will be displayed
- * 往壳组件的模板中添加一个`router-outlet`指令,视图将会被显示在那里
+ 往壳组件的模板中添加一个`router-outlet`指令,视图将会被显示在那里
* configure the router module with `RouterModule.forRoot`
- * 用`RouterModule.forRoot`配置路由器模块
+ 用`RouterModule.forRoot`配置路由器模块
* set the router to compose "HTML 5" browser URLs
-
- * 设置路由器,使其合成“HTML 5”模式的浏览器URL。
+
+ 设置路由器,使其合成“HTML 5”模式的浏览器URL。
* handle invalid routes with a `wildcard` route
-
- * 使用通配符路由来处理无效路由
+
+ 使用通配符路由来处理无效路由
* navigate to the default route when the app launches with an empty path
-
- * 当应用在空路径下启动时,导航到默认路由
+
+ 当应用在空路径下启动时,导航到默认路由
The rest of the starter app is mundane, with little interest from a router perspective.
@@ -1072,19 +1076,19 @@ a#redirect
* separates routing concerns from other application concerns
- * 把路由这个关注点从其它应用类关注点中分离出去
+ 把路由这个关注点从其它应用类关注点中分离出去
* provides a module to replace or remove when testing the application
- * 测试特征模块时,可以替换或移除路由模块
+ 测试特征模块时,可以替换或移除路由模块
* provides a well-known location for routing service providers including guards and resolvers
- * 为路由服务提供商(包括守卫和解析器等)提供一个共同的地方
+ 为路由服务提供商(包括守卫和解析器等)提供一个共同的地方
* does **not** [declare components](../cookbook/ngmodule-faq.html#routing-module)
- * **不要**[声明组件](../cookbook/ngmodule-faq.html#routing-module)
+ **不要**[声明组件](../cookbook/ngmodule-faq.html#routing-module)
:marked
### Refactor routing configuration into a _routing module_
@@ -2316,8 +2320,6 @@ figure.image-display
要导航到`CrisisDetailComponent`以展示`id=2`的危机,完整的URL是`/crisis-center/2` (`/crisis-center` + `''` + `'/2'`)。
- * 要导航到`CrisisDetailComponent`以展示`id=2`的危机,完整的URL是`/crisis-center/2` (`/crisis-center` + `''` + `'/2'`)。
-
The absolute URL for the latter example, including the `localhost` origin, is
本例子中包含站点部分的绝对URL,就是:
@@ -2613,23 +2615,23 @@ a#clear-secondary-routes
* Perhaps the user is not authorized to navigate to the target component.
- * 该用户可能无权导航到目标组件。
+ 该用户可能无权导航到目标组件。
* Maybe the user must login (*authenticate*) first.
- * 可能用户得先登录(认证)。
+ 可能用户得先登录(认证)。
* Maybe you should fetch some data before you display the target component.
- * 在显示目标组件前,我们可能得先获取某些数据。
+ 在显示目标组件前,我们可能得先获取某些数据。
* You might want to save pending changes before leaving a component.
- * 在离开组件前,我们可能要先保存修改。
+ 在离开组件前,我们可能要先保存修改。
* You might ask the user if it's OK to discard pending changes rather than save them.
- * 我们可能要询问用户:你是否要放弃本次更改,而不用保存它们?
+ 我们可能要询问用户:你是否要放弃本次更改,而不用保存它们?
You can add _guards_ to the route configuration to handle these scenarios.
@@ -2641,11 +2643,11 @@ a#clear-secondary-routes
* if it returns `true`, the navigation process continues
- * 如果它返回`true`,导航过程会继续
+ 如果它返回`true`,导航过程会继续
* if it returns `false`, the navigation process stops and the user stays put
- * 如果它返回`false`,导航过程会终止,且用户会留在原地。
+ 如果它返回`false`,导航过程会终止,且用户会留在原地。
.l-sub-section
@@ -2674,23 +2676,23 @@ a#clear-secondary-routes
1. [CanActivate](../api/router/index/CanActivate-interface.html) to mediate navigation *to* a route.
- 1. 用[CanActivate](../api/router/index/CanActivate-interface.html)来处理导航*到*某路由的情况。
+ 用[CanActivate](../api/router/index/CanActivate-interface.html)来处理导航*到*某路由的情况。
2. [CanActivateChild](../api/router/index/CanActivateChild-interface.html) to mediate navigation *to* a child route.
- 2. 用[CanActivateChild](../api/router/index/CanActivateChild-interface.html)处理导航*到*子路由的情况。
+ 用[CanActivateChild](../api/router/index/CanActivateChild-interface.html)处理导航*到*子路由的情况。
3. [CanDeactivate](../api/router/index/CanDeactivate-interface.html) to mediate navigation *away* from the current route.
- 3. 用[CanDeactivate](../api/router/index/CanDeactivate-interface.html)来处理从当前路由*离开*的情况。
+ 用[CanDeactivate](../api/router/index/CanDeactivate-interface.html)来处理从当前路由*离开*的情况。
4. [Resolve](../api/router/index/Resolve-interface.html) to perform route data retrieval *before* route activation.
- 4. 用[Resolve](../api/router/index/Resolve-interface.html)在路由激活*之前*获取路由数据。
+ 用[Resolve](../api/router/index/Resolve-interface.html)在路由激活*之前*获取路由数据。
5. [CanLoad](../api/router/index/CanLoad-interface.html) to mediate navigation *to* a feature module loaded _asynchronously_.
- 5. 用[CanLoad](../api/router/index/CanLoad-interface.html)来处理*异步*导航到某特性模块的情况。
+ 用[CanLoad](../api/router/index/CanLoad-interface.html)来处理*异步*导航到某特性模块的情况。
:marked
You can have multiple guards at every level of a routing hierarchy.
@@ -3687,11 +3689,11 @@ a#final-app
* the *path* of the route to the destination component
- * 指向目标组件的那个路由的*路径(path)*
+ 指向目标组件的那个路由的*路径(path)*
* required and optional route parameters that go into the route URL
- * 必备路由参数和可选路由参数,它们将进入该路由的URL
+ 必备路由参数和可选路由参数,它们将进入该路由的URL
You can bind the `RouterLink` directive to such an array like this:
diff --git a/public/docs/ts/latest/guide/security.jade b/public/docs/ts/latest/guide/security.jade
index df3a00cb51..d695ddba90 100644
--- a/public/docs/ts/latest/guide/security.jade
+++ b/public/docs/ts/latest/guide/security.jade
@@ -75,7 +75,7 @@ h2#best-practices 最佳实践
previous versions. Check the Angular [change
log](https://github.com/angular/angular/blob/master/CHANGELOG.md) for security-related updates.
- * **及时把Angular包更新到最新版本。**
+ **及时把Angular包更新到最新版本。**
我们会频繁的更新Angular库,这些更新可能会修复之前版本中发现的安全漏洞。查看Angular的[更新记录](https://github.com/angular/angular/blob/master/CHANGELOG.md),了解与安全有关的更新。
* **Don't modify your copy of Angular.**
@@ -83,12 +83,12 @@ h2#best-practices 最佳实践
important security fixes and enhancements. Instead, share your Angular improvements with the
community and make a pull request.
- * **不要修改你的Angular副本。**
+ **不要修改你的Angular副本。**
私有的、定制版的Angular往往跟不上最新版本,这可能导致你忽略重要的安全修复与增强。反之,应该在社区共享你对Angular所做的改进并创建Pull Request。
* **Avoid Angular APIs marked in the documentation as “[_Security Risk_](#bypass-security-apis).”**
- * **避免使用本文档中带“[_安全风险_](#bypass-security-apis)”标记的Angular API。**
+ **避免使用本文档中带“[_安全风险_](#bypass-security-apis)”标记的Angular API。**
.l-main-section
h2#xss Preventing cross-site scripting (XSS)
@@ -152,19 +152,19 @@ h2#xss 防范跨站脚本(XSS)攻击
* **HTML** is used when interpreting a value as HTML, for example, when binding to `innerHtml`
- * **HTML**:值需要被解释为HTML时使用,比如当绑定到`innerHTML`时。
+ **HTML**:值需要被解释为HTML时使用,比如当绑定到`innerHTML`时。
* **Style** is used when binding CSS into the `style` property
- * **样式**:值需要作为CSS绑定到`style`属性时使用。
+ **样式**:值需要作为CSS绑定到`style`属性时使用。
* **URL** is used for URL properties such as `
`
- * **URL**:值需要被用作URL属性时使用,比如``。
+ **URL**:值需要被用作URL属性时使用,比如``。
* **Resource URL** is a URL that will be loaded and executed as code, for example, in `