diff --git a/aio/content/guide/animations.md b/aio/content/guide/animations.md index 37a14156d1..39cff53297 100644 --- a/aio/content/guide/animations.md +++ b/aio/content/guide/animations.md @@ -216,7 +216,9 @@ transitions that apply regardless of which state the animation is in. For exampl * The `* => *` transition applies when *any* change between two states takes place. -当在*任意*两个状态之间切换时,`* => *`转场都会生效。
+ 当在*任意*两个状态之间切换时,`* => *`转场都会生效。 + +
The wildcard state can be used to match many different transitions at once
@@ -236,7 +238,9 @@ For example the `* => void` transition applies when the element leaves the view, regardless of what state it was in before it left. -比如当一个元素离开视图时,`* => void`转场就会生效,而不管它在离场以前是什么状态。
+比如当一个元素离开视图时,`* => void`转场就会生效,而不管它在离场以前是什么状态。 + +
The void state can be used for enter and leave transitions
@@ -327,7 +331,9 @@ is: This gives you fine-grained control over each transition: -现在就对每一种转场都有了细粒度的控制:
+现在就对每一种转场都有了细粒度的控制: + +
This example transitions between active, inactive, and void states
diff --git a/aio/content/guide/attribute-directives.md b/aio/content/guide/attribute-directives.md index b14a1c3382..58051753bd 100644 --- a/aio/content/guide/attribute-directives.md +++ b/aio/content/guide/attribute-directives.md @@ -223,7 +223,9 @@ recognizes the directive when it encounters `myHighlight` in the template. Now when the app runs, the `myHighlight` directive highlights the paragraph text. -运行应用,就会看到我们的指令确实高亮了段落中的文本。
+运行应用,就会看到我们的指令确实高亮了段落中的文本。 + +
First Highlight
@@ -559,7 +561,9 @@ Revise the `AppComponent.color` so that it has no initial value. Here are the harness and directive in action. -下面是测试程序和指令的动图。
+下面是测试程序和指令的动图。 + +
Highlight v.2
@@ -625,7 +629,9 @@ Angular之所以知道`defaultColor`绑定属于`HighlightDirective`,是因为 Here's how the harness should work when you're done coding. -当这些代码完成时,测试程序工作时的动图如下:
+当这些代码完成时,测试程序工作时的动图如下: + +
Final Highlight
diff --git a/aio/content/guide/lifecycle-hooks.md b/aio/content/guide/lifecycle-hooks.md index 9303853bb1..bb19ef9787 100644 --- a/aio/content/guide/lifecycle-hooks.md +++ b/aio/content/guide/lifecycle-hooks.md @@ -536,9 +536,13 @@ The heroes will never know they're being watched. Kidding aside, pay attention to two key points: -不开玩笑了,注意下面两个关键点:1. Angular calls hook methods for *directives* as well as components.

+不开玩笑了,注意下面两个关键点: -就像对组件一样,Angular也会对*指令*调用这些钩子方法。2. A spy directive can provide insight into a DOM object that you cannot change directly. +1. Angular calls hook methods for *directives* as well as components.

+ + 就像对组件一样,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 `
`. You can't modify a third party component either. But you can watch both with a directive. @@ -576,7 +580,9 @@ Each spy's birth and death marks the birth and death of the attached hero `
with an entry in the *Hook Log* as seen here: -每个“侦探”的出生和死亡也同时标记出了存放英雄的那个`
`的出生和死亡。*钩子记录*中的结构是这样的:
+每个“侦探”的出生和死亡也同时标记出了存放英雄的那个`
`的出生和死亡。*钩子记录*中的结构是这样的: + +
Spy Directive
@@ -601,6 +607,8 @@ The `ngOnInit()` and `ngOnDestroy()` methods have more vital roles to play in re ### _OnInit()_ +### _OnInit()钩子_ + Use `ngOnInit()` for two main reasons: 使用`ngOnInit()`有两个原因: @@ -675,6 +683,8 @@ That's where the heavy initialization logic belongs. ### _OnDestroy()_ +### _OnDestroy()钩子_ + Put cleanup logic in `ngOnDestroy()`, the logic that *must* run before Angular destroys the directive. 一些清理逻辑*必须*在Angular销毁指令之前运行,把它们放在`ngOnDestroy()`中。 @@ -700,7 +710,6 @@ You risk memory leaks if you neglect to do so. Angular calls its `ngOnChanges()` method whenever it detects changes to ***input properties*** of the component (or directive). -在这个例子中,我们监听了`OnChanges`钩子。 一旦检测到该组件(或指令)的***输入属性***发生了变化,Angular就会调用它的`ngOnChanges()`方法。 This example monitors the `OnChanges` hook. @@ -737,7 +746,9 @@ The host `OnChangesParentComponent` binds to them like this: Here's the sample in action as the user makes changes. -下面是此例子中的当用户做出更改时的操作演示:
+下面是此例子中的当用户做出更改时的操作演示: + +
OnChanges
@@ -793,7 +804,9 @@ so you can see how often `DoCheck` is called. The results are illuminating: 该代码检测一些**相关的值**,捕获当前值并与以前的值进行比较。 当英雄或它的超能力发生了非实质性改变时,我们就往日志中写一条特殊的消息。 -这样你可以看到`DoCheck`被调用的频率。结果非常显眼:
+这样你可以看到`DoCheck`被调用的频率。结果非常显眼: + +
DoCheck
@@ -856,14 +869,12 @@ which can only be reached by querying for the child view via the property decora The `doSomething()` method updates the screen when the hero name exceeds 10 characters. - 当英雄的名字超过10个字符时,`doSomething()`方法就会更新屏幕。 - Why does the `doSomething()` method wait a tick before updating `comment`? 为什么在更新`comment`属性之前,`doSomething()`方法要等上一拍(tick)? diff --git a/aio/content/guide/template-syntax.md b/aio/content/guide/template-syntax.md index 2adea24e28..5030a17ca9 100644 --- a/aio/content/guide/template-syntax.md +++ b/aio/content/guide/template-syntax.md @@ -2429,7 +2429,9 @@ The following contrived example forces the input value to uppercase: Here are all variations in action, including the uppercase version: -这里是所有这些变体的动画,包括这个大写转换的版本:
+这里是所有这些变体的动画,包括这个大写转换的版本: + +
NgModel variations
@@ -2799,7 +2801,9 @@ Here is an illustration of the _trackBy_ effect. * With `trackBy`, only changing the `id` triggers element replacement. -有了`trackBy`,则只有修改了`id`的按钮才会触发元素替换。
+有了`trackBy`,则只有修改了`id`的按钮才会触发元素替换。 + +
trackBy
@@ -3157,7 +3161,9 @@ Don't do both! The terms _input_ and _output_ reflect the perspective of the target directive. -_输入_和_输出_这两个词是从目标指令的角度来说的。
+_输入_和_输出_这两个词是从目标指令的角度来说的。 + +
Inputs and outputs
diff --git a/aio/content/guide/upgrade.md b/aio/content/guide/upgrade.md index f0ac350cae..93363fbc49 100644 --- a/aio/content/guide/upgrade.md +++ b/aio/content/guide/upgrade.md @@ -497,7 +497,9 @@ ways: projection together. -通过透传(transclude)或投影(project)来自另一个框架的内容。`UpgradeModule`牵线搭桥,把AngularJS的透传概念和Angular的内容投影概念关联起来。
+通过透传(transclude)或投影(project)来自另一个框架的内容。`UpgradeModule`牵线搭桥,把AngularJS的透传概念和Angular的内容投影概念关联起来。 + +
DOM element ownership in a hybrid application
@@ -564,7 +566,9 @@ AngularJS and Angular approaches. Here's what happens: detection after every event. -`UpgradeModule`将在每一次离开Angular zone时调用AngularJS的`$rootScope.$apply()`。这样也就同样会在每个事件之后触发AngularJS的变更检测。
+`UpgradeModule`将在每一次离开Angular zone时调用AngularJS的`$rootScope.$apply()`。这样也就同样会在每个事件之后触发AngularJS的变更检测。 + +
Change detection in a hybrid application
diff --git a/aio/content/tutorial/toh-pt6.md b/aio/content/tutorial/toh-pt6.md index 27e704a80a..207c157792 100644 --- a/aio/content/tutorial/toh-pt6.md +++ b/aio/content/tutorial/toh-pt6.md @@ -934,7 +934,9 @@ If you enter characters that match any existing hero names, you'll see something 再次运行该应用,跳转到*仪表盘*,并在英雄下方的搜索框里输入一些文本。 -运行效果如下:
+运行效果如下: + +
Hero Search Component