diff --git a/aio/content/guide/ajs-quick-reference.md b/aio/content/guide/ajs-quick-reference.md index 820aea7421..78c0b097d5 100644 --- a/aio/content/guide/ajs-quick-reference.md +++ b/aio/content/guide/ajs-quick-reference.md @@ -1613,7 +1613,7 @@ also encapsulate a style sheet within a specific component. ### Link tag - ### Link 标签 + ### Link标签 @@ -1639,8 +1639,8 @@ also encapsulate a style sheet within a specific component. With the Angular CLI, you can configure your global styles in the `.angular-cli.json` file. You can rename the extension to `.scss` to use sass. - 在Angular2中,我们可以继续在`index.html`中使用link标签来为应用程序定义样式。 - 但是也能在组件中封装样式。 + 使用 Angular CLI,我们可以在 `.angular-cli.json` 文件中配置全局样式。 + 也可以把扩展名改为 `.scss` 来使用 sass。 ### StyleUrls diff --git a/aio/content/guide/aot-compiler.md b/aio/content/guide/aot-compiler.md index 36e4d6de9f..a968fead9e 100644 --- a/aio/content/guide/aot-compiler.md +++ b/aio/content/guide/aot-compiler.md @@ -12,7 +12,7 @@ This guide explains how to build with the AOT compiler using different compiler Watch compiler author Tobias Bosch explain the Angular Compiler at AngularConnect 2016. - 观看 Angular 编译器的作者Tobias Bosch 在 AngularConnect 2016 上对编译器的解释。 + 观看编译器作者Tobias Bosch在AngularConnect 2016大会里,对Angular编译器的演讲。 @@ -20,7 +20,7 @@ This guide explains how to build with the AOT compiler using different compiler ## Angular compilation -## 概览 +## Angular 中的编译 An Angular application consists largely of components and their HTML templates. Before the browser can render the application, diff --git a/aio/content/guide/architecture.md b/aio/content/guide/architecture.md index b42f7f40e8..4820a80af3 100644 --- a/aio/content/guide/architecture.md +++ b/aio/content/guide/architecture.md @@ -307,11 +307,11 @@ template for our `HeroListComponent`: Although this template uses typical HTML elements like `

` and `

`, it also has some differences. Code like `*ngFor`, `{{hero.name}}`, `(click)`, `[hero]`, and `` uses Angular's [template syntax](guide/template-syntax). 模板除了可以使用像`

`和`

`这样的典型的 HTML 元素,还能使用其它元素。 -例如,像`*ngFor`、`{{hero.name}}`、`(click)`、`[hero]`和``这样的代码使用了 Angular 的[模板语法](guide/template-syntax)。 +例如,像`*ngFor`、`{{hero.name}}`、`(click)`、`[hero]`和``这样的代码使用了 Angular 的[模板语法](guide/template-syntax)。 In the last line of the template, the `` tag is a custom element that represents a new component, `HeroDetailComponent`. -在模板的最后一行,``标签就是一个用来表示新组件`HeroDetailComponent`的自定义元素。 +在模板的最后一行,``标签就是一个用来表示新组件`HeroDetailComponent`的自定义元素。 The `HeroDetailComponent` is a *different* component than the `HeroListComponent` you've been reviewing. The `HeroDetailComponent` (code not shown) presents facts about a particular hero, the @@ -326,7 +326,7 @@ The `HeroDetailComponent` is a **child** of the `HeroListComponent`. Notice how `` rests comfortably among native HTML elements. Custom components mix seamlessly with native HTML in the same layouts. -注意到了吗?``舒适地躺在原生 HTML 元素之间。 +注意到了吗?``舒适地躺在原生 HTML 元素之间。 自定义组件和原生 HTML 在同一布局中融合得天衣无缝。


@@ -384,8 +384,8 @@ where it finds a `` tag in *parent* HTML. For example, if an app's HTML contains ``, then Angular inserts an instance of the `HeroListComponent` view between those tags. - `selector`: CSS 选择器,它告诉 Angular 在*父级* HTML 中查找``标签,创建并插入该组件。 - 例如,如果应用的 HTML 包含``, Angular 就会把`HeroListComponent`的一个实例插入到这个标签中。 + `selector`: CSS 选择器,它告诉 Angular 在*父级* HTML 中查找``标签,创建并插入该组件。 + 例如,如果应用的 HTML 包含``, Angular 就会把`HeroListComponent`的一个实例插入到这个标签中。 * `templateUrl`: module-relative address of this component's HTML template, shown [above](guide/architecture#templates). diff --git a/aio/content/guide/attribute-directives.md b/aio/content/guide/attribute-directives.md index 404a8ed975..4117e77612 100644 --- a/aio/content/guide/attribute-directives.md +++ b/aio/content/guide/attribute-directives.md @@ -180,6 +180,8 @@ This first implementation sets the background color of the host element to yello ## Apply the attribute directive +## 使用属性型指令 + To use the new `HighlightDirective`, add a paragraph (`

`) element to the template of the root `AppComponent` and apply the directive as an attribute. 运行应用,就会看到我们的指令确实高亮了段落中的文本。 @@ -216,7 +218,7 @@ The directive could be more dynamic. It could detect when the user mouses into or out of the element and respond by setting or clearing the highlight color. -当前,`myHighlight`只是简单的设置元素的颜色。 +当前,`appHighlight`只是简单的设置元素的颜色。 这个指令应该在用户鼠标悬浮一个元素时,设置它的颜色。 Begin by adding `HostListener` to the list of imported symbols. @@ -352,8 +354,8 @@ and sets the directive's highlight color with a property binding. You're re-using the directive's attribute selector (`[appHighlight]`) to do both jobs. That's a crisp, compact syntax. -`[myHighlight]`属性同时做了两件事:把这个高亮指令应用到了`

`元素上,并且通过属性绑定设置了该指令的高亮颜色。 -我们复用了该指令的属性选择器`[myHighlight]`来同时完成它们。 +`[appHighlight]`属性同时做了两件事:把这个高亮指令应用到了`

`元素上,并且通过属性绑定设置了该指令的高亮颜色。 +我们复用了该指令的属性选择器`[appHighlight]`来同时完成它们。 这是清爽、简约的语法。 You'll have to rename the directive's `highlightColor` property to `appHighlight` because that's now the color property binding name. @@ -364,7 +366,7 @@ You'll have to rename the directive's `highlightColor` property to `appHighlight This is disagreeable. The word, `appHighlight`, is a terrible property name and it doesn't convey the property's intent. -这可不好。因为`myHighlight`是一个糟糕的属性名,而且不能反映该属性的意图。 +这可不好。因为`appHighlight`是一个糟糕的属性名,而且不能反映该属性的意图。 {@a input-alias} @@ -385,7 +387,7 @@ Restore the original property name and specify the selector as the alias in the _Inside_ the directive the property is known as `highlightColor`. _Outside_ the directive, where you bind to it, it's known as `appHighlight`. -在指令内部,该属性叫`highlightColor`,在外部,当我们绑定到它时,它叫`myHighlight`。 +在指令内部,该属性叫`highlightColor`,在外部,当我们绑定到它时,它叫`appHighlight`。 You get the best of both worlds: the property name you want and the binding syntax you want: @@ -397,7 +399,7 @@ Now that you're binding via the alias to the `highlightColor`, modify the `onMou If someone neglects to bind to `appHighlightColor`, highlight the host element in red: 现在,我们绑定到了`highlightColor`属性,并修改`onMouseEnter()`方法来使用它。 -如果有人忘了绑定到`highlightColor`,那就用红色进行高亮。 +如果有人忘了绑定到`appHighlightColor`,那就用红色进行高亮。 @@ -469,7 +471,7 @@ then with the `defaultColor`, and falls back to "red" if both properties are und How do you bind to a second property when you're already binding to the `appHighlight` attribute name? -当已经绑定过`myHighlight`属性时,要如何绑定到第二个属性呢? +当已经绑定过`appHighlight`属性时,要如何绑定到第二个属性呢? As with components, you can add as many directive property bindings as you need by stringing them along in the template. The developer should be able to write the following template HTML to both bind to the `AppComponent.color` @@ -623,5 +625,5 @@ Now apply that reasoning to the following example: Therefore, the directive property must carry the `@Input` decorator. - `myHighlight`属性位于左侧,它引用了`MyHighlightDirective`中一个*带别名的*属性,它不是模板所属组件的一部分,因此存在信任问题。 + `appHighlight`属性位于左侧,它引用了`HighlightDirective`中一个*带别名的*属性,它不是模板所属组件的一部分,因此存在信任问题。 所以,该属性必须带`@Input`装饰器。 diff --git a/aio/content/guide/bootstrapping.md b/aio/content/guide/bootstrapping.md index 83e89687bc..ecf973f997 100644 --- a/aio/content/guide/bootstrapping.md +++ b/aio/content/guide/bootstrapping.md @@ -59,6 +59,8 @@ The `@NgModule` decorator identifies `AppModule` as an `NgModule` class. * **_bootstrap_**—the _root_ component that Angular creates and inserts into the `index.html` host web page. + **_bootstrap_** — _根_组件,Angular 创建它并插入`index.html`宿主页面。 + The default CLI application only has one component, `AppComponent`, so it is in both the `declarations` and the `bootstrap` arrays. diff --git a/aio/content/guide/browser-support.md b/aio/content/guide/browser-support.md index 83c15ca5a5..331a132acf 100644 --- a/aio/content/guide/browser-support.md +++ b/aio/content/guide/browser-support.md @@ -790,7 +790,7 @@ computed with the closure com ## Polyfills for non-CLI users -## 不使用 CLI 的用户的腻子脚本 +## 非 CLI 的用户的腻子脚本 If you are not using the CLI, you should add your polyfill scripts directly to the host web page (`index.html`), perhaps like this. diff --git a/aio/content/guide/cheatsheet.md b/aio/content/guide/cheatsheet.md index 6de60ba8b6..43eb128737 100644 --- a/aio/content/guide/cheatsheet.md +++ b/aio/content/guide/cheatsheet.md @@ -952,6 +952,8 @@ so the @Directive configuration applies to components as well

+

由类的方法实现。

+ diff --git a/aio/content/guide/component-styles.md b/aio/content/guide/component-styles.md index f03d0a3926..c9dad49002 100644 --- a/aio/content/guide/component-styles.md +++ b/aio/content/guide/component-styles.md @@ -337,6 +337,8 @@ inside `