对上次的合并查漏补缺
This commit is contained in:
parent
446acfd81b
commit
ab06793705
|
@ -227,7 +227,7 @@ a#webpack
|
|||
:marked
|
||||
Webpack will do a `require` behind the scenes to load the templates and styles. Read more [here](../guide/webpack.html#highlights).
|
||||
|
||||
|
||||
Webpack将会在幕后执行一次`require`来加载这些模板和样式。要了解更多,请参阅[这里](../guide/webpack.html#highlights)。
|
||||
:marked
|
||||
See the [Introduction to Webpack](../guide/webpack.html).
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ h2#build-and-run 第七步:编译和运行应用程序
|
|||
"*Observable cannot be found*" indicate an old release of Visual Studio.
|
||||
Exit Visual Studio and follow the [instructions here](https://github.com/Microsoft/TypeScript/issues/8518).
|
||||
|
||||
像“*Property ‘map’ does not exist on type ‘Observable<Response>’*”和“*Observable cannot be found*”这样的编译错误
|
||||
像“*Property `map` does not exist on type `Observable<Response>`*”和“*Observable cannot be found*”这样的编译错误
|
||||
说明Visual Studio的版本太老了。退出Visual Studio,按照[这里的指南](https://github.com/Microsoft/TypeScript/issues/8518)升级Visual Studio。
|
||||
|
||||
You'll be asked to replace the file
|
||||
|
|
|
@ -127,7 +127,7 @@ figure
|
|||
attaching it to one or more elements in the component's template using the "`[@triggerName]`"
|
||||
syntax:
|
||||
|
||||
我们刚刚定义了一个动画,但它还没有被用到任何地方。要想使用它,可以在模板中用`@triggerName`语法来把它附加到一个或多个元素上。
|
||||
我们刚刚定义了一个动画,但它还没有被用到任何地方。要想使用它,可以在模板中用`[@triggerName]`语法来把它附加到一个或多个元素上。
|
||||
|
||||
+makeExample('animations/ts/app/hero-list-basic.component.ts', 'template')(format=".")
|
||||
|
||||
|
|
|
@ -121,6 +121,7 @@ block highlight-directive-1
|
|||
我们先从Angular的`core`库中导入一些符号。
|
||||
然后需要为`@Directive`装饰器导入`Directive`。
|
||||
然后需要导入[注入](dependency-injection.html)到指令构造函数中的`ElementRef`,这样我们才能访问DOM元素。
|
||||
还需要注入`Renderer`服务,以便更改DOM元素的样式。
|
||||
虽然眼下还不需要`Input`,但在稍后的章节中很快就会用到它。
|
||||
|
||||
Then we define the directive metadata in a configuration object passed
|
||||
|
@ -179,7 +180,7 @@ p
|
|||
`ElementRef` is a service that grants us direct access to the DOM element
|
||||
through its `nativeElement` property and with `Renderer` we can set the element style.
|
||||
|
||||
Angular会为每个被指令匹配上的元素创建一个该指令控制器类的实例,并把Angular的`ElementRef`注入进它的构造函数。
|
||||
Angular会为每个被指令匹配上的元素创建一个该指令控制器类的实例,并把Angular的`ElementRef`和`Renderer`注入进它的构造函数。
|
||||
`ElementRef`是一个服务,它赋予我们直接访问DOM元素的能力。通过它的`nativeElement`属性和`Renderer`服务,我们可以设置元素的样式。
|
||||
|
||||
.l-main-section
|
||||
|
|
|
@ -460,7 +460,7 @@ block ctor-syntax
|
|||
:marked
|
||||
Read also **Should I add app-wide providers to the root `AppModule` or the root `AppComponent`?** in the [NgModule FAQ](../cookbook/ngmodule-faq.html#!#q-root-component-or-module) chapter.
|
||||
|
||||
参见[NgModule FAQ](../cookbook/ngmodule-faq.html#!#q-root-component-or-module)一章的**我该把“全应用级”提供商加到根模块还是根组件?**
|
||||
参见[NgModule FAQ](../cookbook/ngmodule-faq.html#!#q-root-component-or-module)一章的**我该把“全应用级”提供商加到根模块`AppModule`还是根组件`AppComponent`?**
|
||||
|
||||
:marked
|
||||
### Preparing the HeroListComponent for injection
|
||||
|
|
|
@ -179,7 +179,7 @@ block example-links
|
|||
Look for a link to a running version of that sample near the top of each page,
|
||||
such as this <live-example name="architecture"></live-example> from the [Architecture](architecture.html) page.
|
||||
|
||||
在每页靠近顶部的地方都可以看到一个链接,指向这个范例的可执行版本,比如[架构](architecture.html)一章中的<live-example></live-example>。
|
||||
在每页靠近顶部的地方都可以看到一个链接,指向这个范例的可执行版本,比如[架构](architecture.html)一章中的<live-example name="architecture"></live-example>。
|
||||
|
||||
The link launches a browser-based code editor where you can inspect, modify, save, and download the code.
|
||||
|
||||
|
|
|
@ -33,38 +33,69 @@ block includes
|
|||
## 目录
|
||||
|
||||
* [Angular modularity](#angular-modularity "Add structure to the app with NgModule")
|
||||
* [Angular模块化](#angular-modularity "用NgModule把结构添加到应用中")
|
||||
* [The application root module](#root-module "The startup module that every app requires")
|
||||
* [应用的根模块](#root-module "任何应用都需要的启动模块")
|
||||
* [Bootstrap](#bootstrap "Launch the app in a browser with the root module as the entry point") the root module
|
||||
* [引导](#bootstrap "在浏览器中把根模块作为入口点来启动应用")根模块
|
||||
* [Declarations](#declarations "Declare the components, directives, and pipes that belong to a module")
|
||||
* [声明](#declarations "声明从属于模块的组件、指令和管道")
|
||||
* [Providers](#providers "Extend the app with additional services")
|
||||
* [提供商](#providers "使用额外的服务来扩展该应用")
|
||||
* [Imports](#imports "Import components, directives, and pipes for use in component templates")
|
||||
* [导入](#imports "为组件模板导入组件、指令和管道")
|
||||
* [Resolve conflicts](#resolve-conflicts "When two directives have the same selector ...")
|
||||
* [解决冲突](#resolve-conflicts "当两个指令具有同一个选择器时……")
|
||||
* [Feature modules](#feature-modules "Partition the app into feature modules")
|
||||
* [特性模块](#feature-modules "把应用分割成一些特性模块")
|
||||
* [Lazy loaded modules](#lazy-load "Load modules asynchronously") with the Router
|
||||
* 通过路由器[延迟加载模块](#lazy-load "延迟加载模块")
|
||||
* [Shared modules](#shared-module "Create modules for commonly used components, directives, and pipes")
|
||||
* [共享模块](#shared-module "为公用的组件、指令和管道创建模块")
|
||||
* [The Core module](#core-module "Create a core module with app-wide singleton services and single-use components")
|
||||
* [核心模块](#core-module "用应用级单例服务和一次性组件创建核心模块")
|
||||
* [Configure core services with _forRoot_](#core-for-root "Configure providers during module import")
|
||||
* [用_forRoot_配置核心服务](#core-for-root "在导入模块时配置提供商")
|
||||
* [Prevent reimport of the _CoreModule_](#prevent-reimport "because bad things happen if a lazy loaded module imports Core")
|
||||
* [禁止重复导入_CoreModule_](#prevent-reimport "如果延迟加载模块导入了核心模块,就会出问题")
|
||||
* [NgModule metadata properties](#ngmodule-properties "A technical summary of the @NgModule metadata properties")
|
||||
* [NgModule元数据的属性](#ngmodule-properties "对@NgModule元数据属性的技术性总结")
|
||||
|
||||
### Live examples
|
||||
### 在线例子
|
||||
|
||||
This page explains Angular Modules through a progression of improvements to a sample with a "Tour of Heroes" theme.
|
||||
Here's an index to live examples at key moments in the evolution of that sample:
|
||||
|
||||
此页面通过一个基于《英雄指南》的渐进式例子解释了Angular的模块。
|
||||
这里是例子演化过程中一些关键节点的在线例子。
|
||||
|
||||
* <live-example plnkr="minimal.0">A minimal NgModule app</live-example>
|
||||
* <live-example plnkr="minimal.0">最小化的NgModule应用</live-example>
|
||||
* <live-example plnkr="contact.1b">The first contact module</live-example>
|
||||
* <live-example plnkr="contact.1b">第一个联系人模块</live-example>
|
||||
* <live-example plnkr="contact.2">The revised contact module</live-example>
|
||||
* <live-example plnkr="contact.2">修改过的联系人模块</live-example>
|
||||
* <live-example plnkr="pre-shared.3">Just before adding _SharedModule_</live-example>
|
||||
* <live-example plnkr="pre-shared.3">添加_SharedModule_之前</live-example>
|
||||
* <live-example>The final version</live-example>
|
||||
* <live-example>最终版</live-example>
|
||||
|
||||
### Frequently Asked Questions (FAQs)
|
||||
|
||||
### 常见问题
|
||||
|
||||
This page covers Angular Module concepts in a tutorial fashion.
|
||||
|
||||
该页面涵盖了英雄指南下的Angular模块概念。
|
||||
|
||||
The companion [Angular Module FAQs](../cookbook/ngmodule-faq.html "Angular Module FAQs") cookbook
|
||||
offers ready answers to specific design and implementation questions.
|
||||
Read this page first before hopping over to those FAQs.
|
||||
|
||||
烹饪宝典中的[Angular模块常见问题](../cookbook/ngmodule-faq.html "Angular模块常见问题")为一些与设计与实现有关的问题提供了答案。
|
||||
不过在阅读FAQ之前,要先阅读此页面。
|
||||
|
||||
.l-hr
|
||||
|
||||
a#angular-modularity
|
||||
|
|
Loading…
Reference in New Issue