diff --git a/aio/content/guide/aot-compiler.md b/aio/content/guide/aot-compiler.md
index 9b59395130..0471294df9 100644
--- a/aio/content/guide/aot-compiler.md
+++ b/aio/content/guide/aot-compiler.md
@@ -333,7 +333,7 @@ JavaScript with [JsDoc](http://usejsdoc.org/) comments needed by the
### *annotationsAs*
Use this option to modify how the Angular specific annotations are emitted to improve tree-shaking. Non-Angular
-annotations and decorators are unnaffected. Default is `static fields`.
+annotations and decorators are unaffected. Default is `static fields`.
使用这个选项来修改生成 Angular 特有注解的方式,以提升摇树优化(tree-shaking)的效果。它对 Angular 自身之外的注解和装饰器无效。
默认值是 `static fields`。
@@ -349,16 +349,6 @@ This tells the compiler to print extra information while compiling templates.
它告诉编译器在编译模板时打印额外的信息。
-### *enableLegacyTemplate*
-
-The use of `` element was deprecated starting in Angular 4.0 in favor of using
-` `, and also includes Angular template-syntax elements, `*ngFor`, `{{hero.name}}`, `(click)`, `[hero]`, and ` Today is {{today | date}} The date is {{today | date:'fullDate'}} The time is {{today | date:'shortTime'}} `, it also has some differences. Code like `*ngFor`, `{{hero.name}}`, `(click)`, `[hero]`, and ` ` 这样的典型的 HTML 元素,还能使用其它元素。
-例如,像 `*ngFor`、`{{hero.name}}`、`(click)`、`[hero]` 和 `Class Name
-
+
+A _component_ controls a patch of screen called a *view*. For example, individual components define and control each of the following views from the [Tutorial](tutorial/index):
+
+* The app root with the navigation links.
+
+ 带有导航链接的应用根组件。
+
+* The list of heroes.
+
+ 英雄列表。
+
+* The hero editor.
+
+ 英雄编辑器。
+
+You define a component's application logic—what it does to support the view—inside a class. The class interacts with the view through an API of properties and methods.
+
+你在类中定义组件的应用逻辑,为视图提供支持。
+组件通过一些由属性和方法组成的 API 与视图交互。
+
+For example, the `HeroListComponent` has a `heroes` property that returns an array of heroes that it acquires from a service. `HeroListComponent` also has a `selectHero()` method that sets a `selectedHero` property when the user clicks to choose a hero from that list.
+
+
+
+## Component metadata
+
+
+
+The `@Component` decorator identifies the class immediately below it as a component class, and specifies its metadata. In the example code below, you can see that `HeroListComponent` is just a class, with no special Angular notation or syntax at all. It's not a component until mark it as one with the `@Component` decorator.
+
+The metadata for a component tells Angular where to get the major building blocks it needs to create and present the component and its view. In particular, it associates a _template_ with the component, either directly with inline code, or by reference. Together, the component and its template describe a _view_.
+
+In addition to containing or pointing to the template, the `@Component` metadata configures, for example, how the component can be referenced in HTML and what services it requires.
+
+ Here's an example of basic metadata for `HeroListComponent`:
+
+
+
+## Templates and views
+
+
+
+You define a component's view with its companion template. A template is a form of HTML that tells Angular how to render the component.
+
+Views are typically arranged hierarchically, allowing you to modify or show and hide entire UI sections or pages as a unit. The template immediately associated with a component defines that component's _host view_. The component can also define a _view hierarchy_, which contains _embedded views_, hosted by other components.
+
+
+
` and `
+
+
+
+
+### Directives
+
+
+
+Angular templates are *dynamic*. When Angular renders them, it transforms the DOM according to the instructions given by *directives*. A directive is a class with a `@Directive` decorator.
+
+A component is technically a directive - but components are so distinctive and central to Angular applications that Angular defines the `@Component` decorator, which extends the `@Directive` decorator with template-oriented features.
+
+There are two kinds of directives besides components: _structural_ and _attribute_ directives. Just as for components, the metadata for a directive associates the class with a `selector` that you use to insert it into HTML. In templates, directives typically appear within an element tag as attributes, either by name or as the target of an assignment or a binding.
+
+#### Structural directives
+
+Structural directives alter layout by adding, removing, and replacing elements in DOM. The example template uses two built-in structural directives to add application logic to how the view is rendered:
+
+
+
+Angular apps are modular and Angular has its own modularity system called _NgModules_. An NgModule is a container for a cohesive block of code dedicated to an application domain, a workflow, or a closely related set of capabilities. It can contain components, service providers, and other code files whose scope is defined by the containing NgModule. It can import functionality that is exported from other NgModules, and export selected functionality for use by other NgModules.
+
+Every Angular app has at least one NgModule class, [the _root module_](guide/bootstrapping), which is conventionally named `AppModule` and resides in a file named `app.module.ts`. You launch your app by *bootstrapping* the root NgModule.
+
+While a small application might have only one NgModule, most apps have many more _feature modules_. The _root_ NgModule for an app is so named because it can include child NgModules in a hierarchy of any depth.
+
+## NgModule metadata
+
+An NgModule is defined as a class decorated with `@NgModule`. The `@NgModule` decorator is a function that takes a single metadata object, whose properties describe the module. The most important properties are as follows.
+
+* `declarations`—The [components](guide/architecture-components), _directives_, and _pipes_ that belong to this NgModule.
+
+* `exports`—The subset of declarations that should be visible and usable in the _component templates_ of other NgModules.
+
+* `imports`—Other modules whose exported classes are needed by component templates declared in _this_ NgModule.
+
+* `providers`—Creators of [services](guide/architecture-services) that this NgModule contributes to the global collection of services; they become accessible in all parts of the app. (You can also specify providers at the component level, which is often preferred.)
+
+* `bootstrap`—The main application view, called the _root component_, which hosts all other app views. Only the _root NgModule_ should set this `bootstrap` property.
+
+Here's a simple root NgModule definition:
+
+
+
+
+
+A component and its template together define a _view_. A component can contain a _view hierarchy_, which allows you to define arbitrarily complex areas of the screen that can be created, modified, and destroyed as a unit. A view hierarchy can mix views defined in components that belong to different NgModules. This is often the case, especially for UI libraries.
+
+
+
+
+
+When you create a component, it is associated directly with a single view, called the _host view_. The host view can be the root of a view hierarchy, which can contain _embedded views_, which are in turn the host views of other components. Those components can be in the same NgModule, or can be imported from other NgModules. Views in the tree can be nested to any depth.
+
+
+
+Angular ships as a collection of JavaScript modules. You can think of them as library modules. Each Angular library name begins with the `@angular` prefix. Install them with the `npm` package manager and import parts of them with JavaScript `import` statements.
+
+
+
+For example, import Angular's `Component` decorator from the `@angular/core` library like this:
+
+例如,象下面这样,从 `@angular/core` 库中导入 `Component` 装饰器:
+
+
diff --git a/aio/content/guide/architecture-next-steps.md b/aio/content/guide/architecture-next-steps.md
new file mode 100644
index 0000000000..713d206c68
--- /dev/null
+++ b/aio/content/guide/architecture-next-steps.md
@@ -0,0 +1,48 @@
+# Next steps: tools and techniques
+
+Once you have understood the basic building blocks, you can begin to learn more about the features and tools that are available to help you develop and deliver Angular applications. Angular provides a lot more features and services that are covered in this documentation.
+
+#### Responsive programming tools
+
+ * [Lifecycle hooks](guide/lifecycle-hooks): Tap into key moments in the lifetime of a component, from its creation to its destruction, by implementing the lifecycle hook interfaces.
+
+ * [Observables and event processing](guide/observables): How to use observables with components and services to publish and subscribe to messages of any type, such as user-interaction events and asynchronous operation results.
+
+#### Client-server interaction tools
+
+ * [HTTP](guide/http): Communicate with a server to get data, save data, and invoke server-side actions with an HTTP client.
+
+ * [Server-side Rendering](guide/universal): Angular Universal generates static application pages on the server through server-side rendering (SSR). This allows you to run your Angular app on the server in order to improve performance and show the first page quickly on mobile and low-powered devices, and also facilitate web crawlers.
+
+ * [Service Workers](guide/service-worker-intro): A service worker is a script that runs in the web browser and manages caching for an application. Service workers function as a network proxy. They intercept outgoing HTTP requests and can, for example, deliver a cached response if one is available. You can significantly improve the user experience by using a service worker to reduce dependency on the network.
+
+#### Domain-specific libraries
+
+ * [Animations](guide/animations): Animate component behavior
+without deep knowledge of animation techniques or CSS with Angular's animation library.
+
+ * [Forms](guide/forms): Support complex data entry scenarios with HTML-based validation and dirty checking.
+
+#### Support for the development cycle
+
+ * [Testing Platform](guide/testing): Run unit tests on your application parts as they interact with the Angular framework.
+
+ * [Internationalization](guide/i18n): Angular's internationalization (i18n) tools can help you make your app available in multiple languages.
+
+ * [Compilation](guide/aot-compiler): Angular provides just-in-time (JIT) compilation for the development environment, and ahead-of-time (AOT) compilation for the production environment.
+
+ * [Security guidelines](guide/security): Learn about Angular's built-in protections against common web-app vulnerabilities and attacks such as cross-site scripting attacks.
+
+#### Setup and deployment tools
+
+ * [Setup for local development](guide/setup): Learn how to set up a new project for development with QuickStart.
+
+ * [Installation](guide/npm-packages): The [Angular CLI](https://cli.angular.io/), Angular applications, and Angular itself depend on features and functionality provided by libraries that are available as [npm](https://docs.npmjs.com/) packages.
+
+ * [Typescript Configuration](guide/typescript-configuration): TypeScript is the primary language for Angular application development.
+
+ * [Browser support](guide/browser-support): Learn how to make your apps compatible across a wide range of browsers.
+
+ * [Deployment](guide/deployment): Learn techniques for deploying your Angular application to a remote server.
+
+
diff --git a/aio/content/guide/architecture-services.md b/aio/content/guide/architecture-services.md
new file mode 100644
index 0000000000..baffcfc92e
--- /dev/null
+++ b/aio/content/guide/architecture-services.md
@@ -0,0 +1,81 @@
+# Introduction to services and dependency injection
+
+
+
+_Service_ is a broad category encompassing any value, function, or feature that an app needs. A service is typically a class with a narrow, well-defined purpose. It should do something specific and do it well.
+
+
+
+Angular distinguishes components from services in order to increase modularity and reusability.
+
+* By separating a component's view-related functionality from other kinds of processing, you can make your component classes lean and efficient. Ideally, a component's job is to enable the user experience and nothing more. It should present properties and methods for data binding, in order to mediate between the view (rendered by the template) and the application logic (which often includes some notion of a _model_).
+
+* A component should not need to define things like how to fetch data from the server, validate user input, or log directly to the console. Instead, it can delegate such tasks to services. By defining that kind of processing task in an injectable service class, you make it available to any component. You can also make your app more adaptable by injecting different providers of the same kind of service, as appropriate in different circumstances.
+
+Angular doesn't *enforce* these principles. Angular does help you *follow* these principles by making it easy to factor your
+application logic into services and make those services available to components through *dependency injection*.
+
+## Service examples
+
+Here's an example of a service class that logs to the browser console:
+
+下面是一个服务类的范例,用于把日志记录到浏览器的控制台:
+
+
+
+## Dependency injection
+
+## 依赖注入(dependency injection)
+
+
+
+Components consume services; that is, you can *inject* a service into a component, giving the component access to that service class.
+
+To define a class as a service in Angular, use the `@Injectable` decorator to provide the metadata that allows Angular to inject it into a component as a *dependency*.
+
+Similarly, use the `@Injectable` decorator to indicate that a component or other class (such as another service, a pipe, or an NgModule) _has_ a dependency. A dependency doesn't have to be a service—it could be a function, for example, or a value.
+
+*Dependency injection* (often called DI) is wired into the Angular framework and used everywhere to provide new components with the services or other things they need.
+
+* The *injector* is the main mechanism. You don't have to create an Angular injector. Angular creates an application-wide injector for you during the bootstrap process.
+
+* The injector maintains a *container* of dependency instances that it has already created, and reuses them if possible.
+
+* A *provider* is a recipe for creating a dependency. For a service, this is typically the service class itself. For any dependency you need in your app, you must register a provider with the app's injector, so that the injector can use it to create new instances.
+
+When Angular creates a new instance of a component class, it determines which services or other dependencies that component needs by looking at the types of its constructor parameters. For example, the constructor of `HeroListComponent` needs a `HeroService`:
+
+
+
diff --git a/aio/content/guide/architecture.md b/aio/content/guide/architecture.md
index 9fd5d715e2..e843637e9d 100644
--- a/aio/content/guide/architecture.md
+++ b/aio/content/guide/architecture.md
@@ -2,912 +2,164 @@
# 架构概览
-Angular is a framework for building client applications in HTML and
-either JavaScript or a language like TypeScript that compiles to JavaScript.
+Angular is a platform and framework for building client applications in HTML and TypeScript.
+Angular is itself written in TypeScript. It implements core and optional functionality as a set of TypeScript libraries that you import into your apps.
-Angular 是一个用 HTML 和 JavaScript 或者一个可以编译成 JavaScript 的语言(例如 Dart 或者 TypeScript ),来构建客户端应用的框架。
+Angular 是一个用 HTML 和 JavaScript 或者一个可以编译成 JavaScript 的语言(例如 Dart 或者 TypeScript ),来构建客户端应用的平台和框架。
-The framework consists of several libraries, some of them core and some optional.
+The basic building blocks of an Angular application are _NgModules_, which provide a compilation context for _components_. NgModules collect related code into functional sets; an Angular app is defined by a set of NgModules. An app always has at least a _root module_ that enables bootstrapping, and typically has many more _feature modules_.
-该框架包括一系列库,有些是核心库,有些是可选库。
+* Components define *views*, which are sets of screen elements that Angular can choose among and modify according to your program logic and data. Every app has at least a root component.
-You write Angular applications by composing HTML *templates* with Angularized markup,
-writing *component* classes to manage those templates, adding application logic in *services*,
-and boxing components and services in *modules*.
+* Components use *services*, which provide specific functionality not directly related to views. Service providers can be *injected* into components as *dependencies*, making your code modular, reusable, and efficient.
-你是这样编写 Angular 应用的:用 Angular 扩展语法编写 HTML *模板*,
-用*组件*类管理这些模板,用*服务*添加应用逻辑,
-用*模块*打包发布组件与服务。
+Both components and services are simply classes, with *decorators* that mark their type and provide metadata that tells Angular how to use them.
-Then you launch the app by *bootstrapping* the _root module_.
-Angular takes over, presenting your application content in a browser and
-responding to user interactions according to the instructions you've provided.
+* The metadata for a component class associates it with a *template* that defines a view. A template combines ordinary HTML with Angular *directives* and *binding markup* that allow Angular to modify the HTML before rendering it for display.
-然后,你通过*引导**根模块*来启动该应用。
-Angular 在浏览器中接管、展现应用的内容,并根据你提供的操作指令响应用户的交互。
+* The metadata for a service class provides the information Angular needs to make it available to components through *Dependency Injection (DI)*.
-Of course, there is more to it than this.
-You'll learn the details in the pages that follow. For now, focus on the big picture.
-
-当然,这只是冰山一角。后面你还会学到更多的细节。不过,目前还是先关注全景图吧。
-
-
-
+Angular defines the `NgModule`, which differs from and complements the JavaScript (ES2015) module. An NgModule declares a compilation context for a set of components that is dedicated to an application domain, a workflow, or a closely related set of capabilities. An NgModule can associate its components with related code, such as services, to form functional units.
-Angular apps are modular and Angular has its own modularity system called _NgModules_.
+Every Angular app has a _root module_, conventionally named `AppModule`, which provides the bootstrap mechanism that launches the application. An app typically contains many functional modules.
-Angular 应用是模块化的,并且 Angular 有自己的模块系统,它被称为 *Angular 模块*或 *NgModules*。
+Like JavaScript modules, NgModules can import functionality from other NgModules, and allow their own functionality to be exported and used by other NgModules. For example, to use the router service in your app, you import the `Router` NgModule.
-NgModules are a big deal.
-This page introduces modules; the [NgModules](guide/ngmodules) pages
-relating to NgModules covers them in detail.
-
-NgModules 很重要。这里只是简单介绍,在 [NgModules](guide/ngmodules)中会做深入讲解。
-
-
-
-Every Angular app has at least one NgModule class, [the _root module_](guide/bootstrapping "Bootstrapping"),
-conventionally named `AppModule`.
-
-每个 Angular 应用至少有一个模块([*根模块*](guide/bootstrapping "引导启动")),习惯上命名为 `AppModule`。
-
-While the _root module_ may be the only module in a small application, most apps have many more
-_feature modules_, each a cohesive block of code dedicated to an application domain,
-a workflow, or a closely related set of capabilities.
-
-*根模块*在一些小型应用中可能是唯一的模块,大多数应用会有很多*特性模块*,每个模块都是一个内聚的代码块专注于某个应用领域、工作流或紧密相关的功能。
-
-An NgModule, whether a _root_ or _feature_, is a class with an `@NgModule` decorator.
-
-Angular 模块(无论是*根模块*还是*特性模块*)都是一个带有 `@NgModule` 装饰器的类。
+Organizing your code into distinct functional modules helps in managing development of complex applications, and in designing for reusability. In addition, this technique lets you take advantage of _lazy-loading_—that is, loading modules on demand—in order to minimize the amount of code that needs to be loaded at startup.
-
-Angular ships as a collection of JavaScript modules. You can think of them as library modules.
-
-Angular 提供了一组 JavaScript 模块。可以把它们看做库模块。
-
-Each Angular library name begins with the `@angular` prefix.
-
-每个 Angular 库的名字都带有 `@angular` 前缀。
-
-You install them with the **npm** package manager and import parts of them with JavaScript `import` statements.
-
-用 **npm** 包管理工具安装它们,用 JavaScript 的 `import` 语句导入其中某些部件。
-
-
-
-For example, import Angular's `Component` decorator from the `@angular/core` library like this:
-
-例如,象下面这样,从 `@angular/core` 库中导入 `Component` 装饰器:
-
-
-
## Components
## 组件
-
+Every Angular application has at least one component, the *root component* that connects a component hierarchy with the page DOM. Each component defines a class that contains application data and logic, and is associated with an HTML *template* that defines a view to be displayed in a target environment.
-A _component_ controls a patch of screen called a *view*.
-
-*组件*负责控制屏幕上的一小块区域叫做*视图*。
-
-For example, the following views are controlled by components:
-
-例如,下列视图都是由组件控制的:
-
-* The app root with the navigation links.
-
- 带有导航链接的应用根组件。
-
-* The list of heroes.
-
- 英雄列表。
-
-* The hero editor.
-
- 英雄编辑器。
-
-You define a component's application logic—what it does to support the view—inside a class.
-The class interacts with the view through an API of properties and methods.
-
-你在类中定义组件的应用逻辑,为视图提供支持。
-组件通过一些由属性和方法组成的 API 与视图交互。
-
-{@a component-code}
-
-For example, this `HeroListComponent` has a `heroes` property that returns an array of heroes
-that it acquires from a service.
-`HeroListComponent` also has a `selectHero()` method that sets a `selectedHero` property when the user clicks to choose a hero from that list.
-
-例如,`HeroListComponent` 有一个 `heroes` 属性,它返回一个英雄数组,这个数组从一个服务获得。
-`HeroListComponent` 还有一个当用户从列表中点选一个英雄时设置 `selectedHero` 属性的 `selectHero()` 方法。
-
-
-
-## Templates
-
-## 模板
-
-
-
-You define a component's view with its companion **template**. A template is a form of HTML
-that tells Angular how to render the component.
-
-你通过组件的自带的**模板**来定义组件视图。模板以 HTML 形式存在,告诉 Angular 如何渲染组件。
-
-A template looks like regular HTML, except for a few differences. Here is a
-template for our `HeroListComponent`:
-
-多数情况下,模板看起来很像标准 HTML,当然也有一点不同的地方。下面是 `HeroListComponent` 组件的一个模板:
-
-
` and `
` 和 `
-
-Notice how `
-
-## Metadata
-
-## 元数据
-
-
-
-Metadata tells Angular how to process a class.
-
-元数据告诉 Angular 如何处理一个类。
-
-
-
-[Looking back at the code](guide/architecture#component-code) for `HeroListComponent`, you can see that it's just a class.
-There is no evidence of a framework, no "Angular" in it at all.
-
-[回头看看](guide/architecture#component-code)`HeroListComponent` 就会明白:它只是一个类。
-一点框架的痕迹也没有,里面完全没有出现 "Angular" 的字样。
-
-In fact, `HeroListComponent` really is *just a class*. It's not a component until you *tell Angular about it*.
-
-实际上,`HeroListComponent` 真的*只是一个类*。直到你*告诉 Angular* 它是一个组件。
-
-To tell Angular that `HeroListComponent` is a component, attach **metadata** to the class.
-
-要告诉 Angular `HeroListComponent` 是个组件,只要把**元数据**附加到这个类。
-
-In TypeScript, you attach metadata by using a **decorator**.
-Here's some metadata for `HeroListComponent`:
-
-在 TypeScript 中,你要用**装饰器 (decorator) **来附加元数据。
-下面就是 `HeroListComponent` 的一些元数据。
-
-
-
-The metadata in the `@Component` tells Angular where to get the major building blocks you specify for the component.
-
-`@Component` 里面的元数据会告诉 Angular 从哪里获取你为组件指定的主要的构建块。
-
-The template, metadata, and component together describe a view.
-
-模板、元数据和组件共同描绘出这个视图。
-
-Apply other metadata decorators in a similar fashion to guide Angular behavior.
-`@Injectable`, `@Input`, and `@Output` are a few of the more popular decorators.
-
-其它元数据装饰器用类似的方式来指导 Angular 的行为。
-例如 `@Injectable`、`@Input` 和 `@Output` 等是一些最常用的装饰器。
-
-
-
-The architectural takeaway is that you must add metadata to your code
-so that Angular knows what to do.
-
-这种架构处理方式是:你向代码中添加元数据,以便 Angular 知道该怎么做。
-
-
-
-## Data binding
-
-## 数据绑定 (data binding)
-
-Without a framework, you would be responsible for pushing data values into the HTML controls and turning user responses
-into actions and value updates. Writing such push/pull logic by hand is tedious, error-prone, and a nightmare to
-read as any experienced jQuery programmer can attest.
-
-如果没有框架,你就得自己把数据值推送到 HTML 控件中,并把用户的反馈转换成动作和值更新。
-如果手工写代码来实现这些推/拉逻辑,肯定会枯燥乏味、容易出错,读起来简直是噩梦 —— 写过 jQuery 的程序员大概都对此深有体会。
-
-
-
-Angular supports **data binding**,
-a mechanism for coordinating parts of a template with parts of a component.
-Add binding markup to the template HTML to tell Angular how to connect both sides.
-
-Angular 支持**数据绑定**,一种让模板的各部分与组件的各部分相互合作的机制。
-往模板 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 以及双向绑定。
-
-
-
-The `HeroListComponent` [example](guide/architecture#templates) template has three forms:
-
-`HeroListComponent`[示例](guide/architecture#templates)模板中有三种形式:
-
-
-
-
-
-## Directives
-
-## 指令
-
-
-
-Angular templates are *dynamic*. When Angular renders them, it transforms the DOM
-according to the instructions given by **directives**.
-
-Angular 模板是*动态的*。当 Angular 渲染它们时,它会根据**指令**提供的操作对 DOM 进行转换。
-
-A directive is a class with a `@Directive` decorator.
-A component is a *directive-with-a-template*;
-a `@Component` decorator is actually a `@Directive` decorator extended with template-oriented features.
-
-组件是一个*带模板的指令*;`@Component` 装饰器实际上就是一个 `@Directive` 装饰器,只是扩展了一些面向模板的特性。
+The `@Component` decorator identifies the class immediately below it as a component, and provides the template and related component-specific metadata.
-## Services
+## What's next
-## 服务
-
-
-
-_Service_ is a broad category encompassing any value, function, or feature that your application needs.
-
-*服务*是一个广义范畴,包括:值、函数,或应用所需的特性。
-
-Almost anything can be a service.
-A service is typically a class with a narrow, well-defined purpose. It should do something specific and do it well.
-
-几乎任何东西都可以是一个服务。
-典型的服务是一个类,具有专注的、明确的用途。它应该做一件特定的事情,并把它做好。
-
-
-
-Examples include:
-
-例如:
-
-* logging service
-
- 日志服务
-
-* data service
-
- 数据服务
-
-* message bus
-
- 消息总线
-
-* tax calculator
-
- 税款计算器
-
-* application configuration
-
- 应用程序配置
-
-There is nothing specifically _Angular_ about services. Angular has no definition of a service.
-There is no service base class, and no place to register a service.
-
-服务没有什么特别属于 *Angular* 的特性。 Angular 对于服务也没有什么定义。
-它甚至都没有定义服务的基类,也没有地方注册一个服务。
-
-Yet services are fundamental to any Angular application. Components are big consumers of services.
-
-即便如此,服务仍然是任何 Angular 应用的基础。组件就是最大的*服务*消费者。
-
-Here's an example of a service class that logs to the browser console:
-
-下面是一个服务类的范例,用于把日志记录到浏览器的控制台:
-
-
-
-## Dependency injection
-
-## 依赖注入(dependency injection)
-
-
-
-_Dependency injection_ is a way to supply a new instance of a class
-with the fully-formed dependencies it requires. Most dependencies are services.
-Angular uses dependency injection to provide new components with the services they need.
-
-“依赖注入”是提供类的新实例的一种方式,还负责处理好类所需的全部依赖。大多数依赖都是服务。
-Angular 使用依赖注入来提供新组件以及组件所需的服务。
-
-
-
-Angular can tell which services a component needs by looking at the types of its constructor parameters.
-For example, the constructor of your `HeroListComponent` needs a `HeroService`:
-
-Angular 通过查看构造函数的参数类型得知组件需要哪些服务。
-例如,`HeroListComponent` 组件的构造函数需要一个 `HeroService` 服务:
-
-
+
-
-## Wrap up
-
-## 总结
-
-You've learned the basics about the eight main building blocks of an Angular application:
-
-你学到的这些只是关于 Angular 应用程序的八个主要构造块的基础知识:
-
-* [Modules](guide/architecture#modules)
-
- [模块](guide/architecture#modules)
-
-* [Components](guide/architecture#components)
-
- [组件](guide/architecture#components)
-
-* [Templates](guide/architecture#templates)
-
- [模板](guide/architecture#templates)
-
-* [Metadata](guide/architecture#metadata)
-
- [元数据](guide/architecture#metadata)
-
-* [Data binding](guide/architecture#data-binding)
-
- [数据绑定](guide/architecture#data-binding)
-
-* [Directives](guide/architecture#directives)
-
- [指令](guide/architecture#directives)
-
-* [Services](guide/architecture#services)
-
- [服务](guide/architecture#services)
-
-* [Dependency injection](guide/architecture#dependency-injection)
-
- [依赖注入](guide/architecture#dependency-injection)
-
-That's a foundation for everything else in an Angular application,
-and it's more than enough to get going.
-But it doesn't include everything you need to know.
-
-这是 Angular 应用程序中所有其它东西的基础,要使用 Angular,以这些作为开端就绰绰有余了。
-但它仍然没有包含你需要知道的一切。
-
-Here is a brief, alphabetical list of other important Angular features and services.
-Most of them are covered in this documentation (or soon will be).
-
-这里是一个简短的、按字母排序的列表,列出了其它重要的 Angular 特性和服务。
-它们大多数已经(或即将)包括在这份开发文档中:
-
-> [**Animations**](guide/animations): Animate component behavior
-without deep knowledge of animation techniques or CSS with Angular's animation library.
-
-> [**动画**](guide/animations):用 Angular 的动画库让组件动起来,而不需要对动画技术或 CSS 有深入的了解。
-
-> **Change detection**: The change detection documentation will cover how Angular decides that a component property value has changed,
-when to update the screen, and how it uses **zones** to intercept asynchronous activity and run its change detection strategies.
-
-> **变更检测**:变更检测文档会告诉你 Angular 是如何决定组件的属性值变化,什么时候该更新到屏幕,
-以及它是如何利用**区域 (zone)** 来拦截异步活动并执行变更检测策略。
-
-> **Events**: The events documentation will cover how to use components and services to raise events with mechanisms for
-publishing and subscribing to events.
-
-> **事件**:事件文档会告诉你如何使用组件和服务触发支持发布和订阅的事件。
-
-> [**Forms**](guide/forms): Support complex data entry scenarios with HTML-based validation and dirty checking.
-
-> [**表单**](guide/forms):通过基于 HTML 的验证和脏检查机制支持复杂的数据输入场景。
-
-> [**HTTP**](guide/http): Communicate with a server to get data, save data, and invoke server-side actions with an HTTP client.
-
-> [**HTTP**](guide/http):通过 HTTP 客户端,可以与服务器通讯,以获得数据、保存数据和触发服务端动作。
-
-> [**Lifecycle hooks**](guide/lifecycle-hooks): Tap into key moments in the lifetime of a component, from its creation to its destruction,
-by implementing the lifecycle hook interfaces.
-
-> [**生命周期钩子**](guide/lifecycle-hooks):通过实现生命周期钩子接口,可以切入组件生命中的几个关键点:从创建到销毁。
-
-> [**Pipes**](guide/pipes): Use pipes in your templates to improve the user experience by transforming values for display. Consider this `currency` pipe expression:
->
-> [**管道**](guide/pipes):在模板中使用管道转换成用于显示的值,以增强用户体验。例如,`currency` 管道表达式:
->
-> > `price | currency:'USD':true`
->
-> It displays a price of 42.33 as `$42.33`.
->
-> 它把价格“42.33”显示为 `$42.33`。
->
-
-> [**Router**](guide/router): Navigate from page to page within the client
- application and never leave the browser.
-
-> [**路由器**](guide/router):在应用程序客户端的页面间导航,并且不离开浏览器。
-
-> [**Testing**](guide/testing): Run unit tests on your application parts as they interact with the Angular framework
-using the _Angular Testing Platform_.
-
-
-> [**测试**](guide/testing):使用 _Angular 测试平台_,在你的应用部件与 Angular 框架交互时进行单元测试。
+declarations
of this module.
@Component
extends @Directive
,
so the @Directive
configuration applies to components as well
@Component
继承自 @Directive
,
-因此,@Directive
的这些配置项也同样适用于组件。
@Component
继承自 @Directive
,
+ 因此,@Directive
的这些配置项也同样适用于组件。
+ | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | Operation - + 操作 - + | -+ | Observable 可观察对象 - + | -+ | Promise 承诺 - + | - +|||||||||||||||||
+ | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | Observable 可观察对象 - + | -+ | Events API 事件 API - + | - +||||||||||||||
+ | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | Observable 可观察对象 - + | -+ | Array 数组 - + | - +|||||||||
Component - + 组件 | diff --git a/aio/content/guide/module-types.md b/aio/content/guide/module-types.md index 862aadb468..1eda0edb22 100644 --- a/aio/content/guide/module-types.md +++ b/aio/content/guide/module-types.md @@ -12,15 +12,15 @@ A basic understanding of the following concepts: * [Feature Modules](guide/feature-modules). - [特性模块](guide/feature-modules)。 + [特性模块](guide/feature-modules) * [JavaScript Modules vs. NgModules](guide/ngmodule-vs-jsmodule). - [JavaScript 模块与 NgModules](guide/ngmodule-vs-jsmodule)。 + [JavaScript 模块与 NgModules](guide/ngmodule-vs-jsmodule)。 * [Frequently Used Modules](guide/frequent-ngmodules). - [常用模块](guide/frequent-ngmodules)。 + [常用模块](guide/frequent-ngmodules)。A list of components that are automatically bootstrapped. - + 要自动启动的组件列表。 Usually there's only one component in this list, the _root component_ of the application. @@ -340,7 +340,7 @@ The following table summarizes the `@NgModule` metadata properties. |
A list of components that can be dynamically loaded into the view.
-
+
那些可以动态加载进视图的组件列表。
By default, an Angular app always has at least one entry component, the root component, `AppComponent`. Its purpose is to serve as a point of entry into the app, that is, you bootstrap it to launch the app.
@@ -394,15 +394,15 @@ You may also be interested in the following:
* [Feature Modules](guide/feature-modules).
- [特性模块](guide/feature-modules)。
+ [特性模块](guide/feature-modules)
* [Entry Components](guide/entry-components).
- [入口组件](guide/entry-components)。
+ [入口组件](guide/entry-components)
* [Providers](guide/providers).
- [提供商](guide/providers)。
+ [提供商](guide/providers)。
* [Types of Feature Modules](guide/module-types).
diff --git a/aio/content/guide/ngmodule-faq.md b/aio/content/guide/ngmodule-faq.md
index 55a995caf7..a55b36bd5d 100644
--- a/aio/content/guide/ngmodule-faq.md
+++ b/aio/content/guide/ngmodule-faq.md
@@ -12,6 +12,8 @@ A basic understanding of the following concepts:
* [NgModules](guide/ngmodules).
+ [Angular 模块](guide/ngmodules).
+
NgModules help organize an application into cohesive blocks of functionality. diff --git a/aio/content/guide/ngmodule-vs-jsmodule.md b/aio/content/guide/ngmodule-vs-jsmodule.md index 41a16d4b79..29fbb9e4b7 100644 --- a/aio/content/guide/ngmodule-vs-jsmodule.md +++ b/aio/content/guide/ngmodule-vs-jsmodule.md @@ -57,7 +57,7 @@ NgModule 是一些带有 `@NgModule` 装饰器的类。`@NgModule` 装饰器的 The `AppModule` generated from the Angular CLI demonstrates both kinds of modules in action: -Angular CLI 生成的 `AppModule` 实际演示了这两种模块: +Angular CLI 生成的 `AppModule` 实际演示了这两种模块: ```typescript @@ -94,7 +94,7 @@ Declarables are the only classes that matter to the [Angular compiler](guide/ngm * Instead of defining all member classes in one giant file as in a JavaScript module, you list the module's classes in the `@NgModule.declarations` list. - 与 JavaScript 类把它所有的成员类都放在一个巨型文件中不同,你要把该模块的类列在它的 `@NgModule.declarations` 列表中。 + 与 JavaScript 类把它所有的成员类都放在一个巨型文件中不同,你要把该模块的类列在它的 `@NgModule.declarations` 列表中。 * An NgModule can only export the [declarable classes](guide/ngmodule-faq#q-declarable) it owns or imports from other modules. It doesn't declare or export any other kind of class. @@ -104,7 +104,7 @@ it owns or imports from other modules. It doesn't declare or export any other ki * Unlike JavaScript modules, an NgModule can extend the _entire_ application with services by adding providers to the `@NgModule.providers` list. - 与 JavaScript 模块不同,NgModule 可以通过把服务提供商加到 `@NgModule.providers` 列表中,来用服务扩展*整个*应用。 + 与 JavaScript 模块不同,NgModule 可以通过把服务提供商加到 `@NgModule.providers` 列表中,来用服务扩展*整个*应用。 @@ -118,11 +118,11 @@ For more information on NgModules, see: * [Bootstrapping](guide/bootstrapping). - [引导](guide/bootstrapping). + [引导启动](guide/bootstrapping)。 * [Frequently used modules](guide/frequent-ngmodules). - [常用模块](guide/frequent-ngmodules). + [常用模块](guide/frequent-ngmodules)。 * [Providers](guide/providers). diff --git a/aio/content/guide/ngmodules.md b/aio/content/guide/ngmodules.md index 7ba253ad93..c33fc25759 100644 --- a/aio/content/guide/ngmodules.md +++ b/aio/content/guide/ngmodules.md @@ -12,11 +12,11 @@ A basic understanding of the following concepts: * [Bootstrapping](guide/bootstrapping). - [引导启动](guide/bootstrapping)。 + [引导启动](guide/bootstrapping)。 * [JavaScript Modules vs. NgModules](guide/ngmodule-vs-jsmodule). - [JavaScript 模块与 NgModules](guide/ngmodule-vs-jsmodule)。 + [JavaScript 模块与 NgModules](guide/ngmodule-vs-jsmodule)。 @@ -83,19 +83,19 @@ NgModule 的元数据会做这些: * Declares which components, directives, and pipes belong to the module. - 声明某些组件、指令和管道属于这个模块。 + 声明某些组件、指令和管道属于这个模块。 * Makes some of those components, directives, and pipes public so that other module's component templates can use them. - 公开其中的部分组件、指令和管道,以便其它模块中的组件模板中可以使用它们。 + 公开其中的部分组件、指令和管道,以便其它模块中的组件模板中可以使用它们。 * Imports other modules with the components, directives, and pipes that components in the current module need. - 导入其它带有组件、指令和管道的模块,这些模块中的元件都是本模块所需的。 + 导入其它带有组件、指令和管道的模块,这些模块中的元件都是本模块所需的。 * Provides services that the other application components can use. - 提供一些供应用中的其它组件使用的服务。 + 提供一些供应用中的其它组件使用的服务。 Every Angular app has at least one module, the root module. You [bootstrap](guide/bootstrapping) that module to launch the application. @@ -141,15 +141,15 @@ You may also be interested in the following: * [Feature Modules](guide/feature-modules). - [特性模块](guide/feature-modules) + [特性模块](guide/feature-modules) * [Entry Components](guide/entry-components). - [入口组件](guide/entry-components) + [入口组件](guide/entry-components) * [Providers](guide/providers). - [服务提供商](guide/providers). + [提供商](guide/providers)。 * [Types of NgModules](guide/module-types). diff --git a/aio/content/guide/npm-packages.md b/aio/content/guide/npm-packages.md index 5b61f488e8..7239c01ce3 100644 --- a/aio/content/guide/npm-packages.md +++ b/aio/content/guide/npm-packages.md @@ -80,7 +80,7 @@ The *devDependencies* are only necessary to *develop* the application. {@a dependencies} -## *dependencies* +## *Dependencies* The `dependencies` section of `package.json` contains: @@ -193,7 +193,7 @@ which polyfills missing features for several popular browser. {@a dev-dependencies} -## *devDependencies* +## *DevDependencies* The packages listed in the *devDependencies* section of the `package.json` help you develop the application on your local machine. diff --git a/aio/content/guide/observables-in-angular.md b/aio/content/guide/observables-in-angular.md index 108ae56085..7e86fe4145 100644 --- a/aio/content/guide/observables-in-angular.md +++ b/aio/content/guide/observables-in-angular.md @@ -8,15 +8,15 @@ Angular 使用可观察对象作为处理各种常用异步操作的接口。比 * The `EventEmitter` class extends `Observable`. - `EventEmitter` 类派生自 `Observable`。 + `EventEmitter` 类派生自 `Observable`。 * The HTTP module uses observables to handle AJAX requests and responses. - HTTP 模块使用可观察对象来处理 AJAX 请求和响应。 + HTTP 模块使用可观察对象来处理 AJAX 请求和响应。 * The Router and Forms modules use observables to listen for and respond to user-input events. - 路由器和表单模块使用可观察对象来监听对用户输入事件的响应。 + 路由器和表单模块使用可观察对象来监听对用户输入事件的响应。 ## Event emitter @@ -46,19 +46,19 @@ Angular 的 `HttpClient` 从 HTTP 方法调用中返回了可观察对象。例 * Observables do not mutate the server response (as can occur through chained `.then()` calls on promises). Instead, you can use a series of operators to transform values as needed. - 可观察对象不会修改服务器的响应(和在承诺上串联起来的 `.then()` 调用一样)。反之,你可以使用一系列操作符来按需转换这些值。 + 可观察对象不会修改服务器的响应(和在承诺上串联起来的 `.then()` 调用一样)。反之,你可以使用一系列操作符来按需转换这些值。 * HTTP requests are cancellable through the `unsubscribe()` method. - HTTP 请求是可以通过 `unsubscribe()` 方法来取消的。 + HTTP 请求是可以通过 `unsubscribe()` 方法来取消的。 * Requests can be configured to get progress event updates. - 请求可以进行配置,以获取进度事件的变化。 + 请求可以进行配置,以获取进度事件的变化。 * Failed requests can be retried easily. - 失败的请求很容易重试。 + 失败的请求很容易重试。 ## Async pipe diff --git a/aio/content/guide/observables.md b/aio/content/guide/observables.md index 30616cdf34..ce04c3e7fa 100644 --- a/aio/content/guide/observables.md +++ b/aio/content/guide/observables.md @@ -79,11 +79,11 @@ An `Observable` instance begins publishing values only when someone subscribes t * `Observable.of(...items)`—Returns an `Observable` instance that synchronously delivers the values provided as arguments. - `Observable.of(...items)` —— 返回一个 `Observable` 实例,它用同步的方式把参数中提供的这些值发送出来。 + `Observable.of(...items)` —— 返回一个 `Observable` 实例,它用同步的方式把参数中提供的这些值发送出来。 * `Observable.from(iterable)`—Converts its argument to an `Observable` instance. This method is commonly used to convert an array to an observable. - `Observable.from(iterable)` —— 把它的参数转换成一个 `Observable` 实例。 + `Observable.from(iterable)` —— 把它的参数转换成一个 `Observable` 实例。 该方法通常用于把一个数组转换成一个(发送多个值的)可观察对象。 diff --git a/aio/content/guide/practical-observable-usage.md b/aio/content/guide/practical-observable-usage.md index 2107ac8d5f..87a8543135 100644 --- a/aio/content/guide/practical-observable-usage.md +++ b/aio/content/guide/practical-observable-usage.md @@ -16,23 +16,23 @@ Observables can simplify the implementation of type-ahead suggestions. Typically * Listen for data from an input. - 从输入中监听数据。 + 从输入中监听数据。 * Trim the value (remove whitespace) and make sure it’s a minimum length. - 移除输入值前后的空白字符,并确认它达到了最小长度。 + 移除输入值前后的空白字符,并确认它达到了最小长度。 * Debounce (so as not to send off API requests for every keystroke, but instead wait for a break in keystrokes). - 防抖(这样才能防止连续按键时每次按键都发起 API 请求,而应该等到按键出现停顿时才发起) + 防抖(这样才能防止连续按键时每次按键都发起 API 请求,而应该等到按键出现停顿时才发起) * Don’t send a request if the value stays the same (rapidly hit a character, then backspace, for instance). - 如果输入值没有变化,则不要发起请求(比如按某个字符,然后快速按退格)。 + 如果输入值没有变化,则不要发起请求(比如按某个字符,然后快速按退格)。 * Cancel ongoing AJAX requests if their results will be invalidated by the updated results. - 如果已发出的 AJAX 请求的结果会因为后续的修改而变得无效,那就取消它。 + 如果已发出的 AJAX 请求的结果会因为后续的修改而变得无效,那就取消它。 Writing this in full JavaScript can be quite involved. With observables, you can use a simple series of RxJS operators: diff --git a/aio/content/guide/providers.md b/aio/content/guide/providers.md index 26f3f48de6..087b7574ab 100644 --- a/aio/content/guide/providers.md +++ b/aio/content/guide/providers.md @@ -8,11 +8,11 @@ * A basic understanding of [Bootstrapping](guide/bootstrapping). - 对[引导](guide/bootstrapping)有基本的了解。 + 对[引导](guide/bootstrapping)有基本的了解。 * Familiarity with [Frequently Used Modules](guide/frequent-ngmodules). - 熟悉[常用模块](guide/frequent-ngmodules). + 熟悉[常用模块](guide/frequent-ngmodules). For the final sample app using the provider that this page describes, see the
-This guide touches only briefly on `Validators`. For an in-depth look at them,
-read the [Form Validation](guide/form-validation) guide.
+This simple control doesn't have data or validators.
+In real apps, most form controls have both. For in-depth information on
+`Validators`, see the [Form Validation](guide/form-validation) guide.
-本章中只会接触 `Validators` 中的一点点,要想更深入的了解它们,请阅读[表单验证](guide/form-validation)一章。
+最简单的控件并不需要数据或验证器,但是在实际应用中,大部分表单控件都会同时具备它们。
+要想深入了解 `Validators`,参见[表单验证](guide/form-validation)一章。
@@ -318,9 +314,9 @@ read the [Form Validation](guide/form-validation) guide.
## 创建模板
-Now update the component's template, with the following markup.
+Now update the component's template with the following markup.
-现在,修改组件的模板文件 `src/app/hero-detail.component.html`,内容如下:
+现在,把组件的模板文件 `src/app/hero-detail.component.html` 修改为如下内容:
-Disregard the `form-control` _CSS_ class. It belongs to the
+Disregard the `form-control` CSS class. It belongs to the
Bootstrap CSS library,
-not Angular.
-It _styles_ the form but in no way impacts the logic of the form.
+not Angular, and styles the form but in no way impacts the logic.
请忽略 CSS 类 `form-control`,它属于Bootstrap CSS library而不是 Angular。
它会为表单添加样式,但是对表单的逻辑毫无影响。
@@ -346,11 +341,11 @@ It _styles_ the form but in no way impacts the logic of the form.
{@a import}
-## Import the _ReactiveFormsModule_
+## Import the `ReactiveFormsModule`
## 导入 `ReactiveFormsModule`
-The HeroDetailComponent template uses `formControlName`
+The `HeroDetailComponent` template uses the `formControlName`
directive from the `ReactiveFormsModule`.
`HeroDetailComponent` 的模板中使用了来自 `ReactiveFormsModule` 的 `formControlName`。
@@ -374,7 +369,7 @@ the `ReactiveFormsModule`.
{@a update}
-## Display the _HeroDetailComponent_
+## Display the `HeroDetailComponent`
## 显示 `HeroDetailComponent`
@@ -388,64 +383,149 @@ Revise the `AppComponent` template so it displays the `HeroDetailComponent`.
{@a essentials}
-### Essential form classes
+## Essential form classes
-### 基础的表单类
+## 基础的表单类
-It may be helpful to read a brief description of the core form classes.
+This guide uses four fundamental classes to build a reactive form:
-阅读一下这些核心表单类的简短描述也许会有用。
+本文使用四个基础类来构建响应式表单:
-* [_AbstractControl_](api/forms/AbstractControl "API Reference: AbstractControl")
-is the abstract base class for the three concrete form control classes:
+
![]()
Reactive validators are simple, composable functions.
-Configuring validation is harder in template-driven forms where you must wrap validators in a directive.
+Configuring validation is different in template-driven forms in that you must wrap validators in a directive.
响应式验证器是一些简单、可组合的函数。
在模板驱动表单中配置验证器有些困难,因为你必须把验证器包装进指令中。
@@ -695,8 +749,8 @@ The browser displays the following:
![]() |