docs(API): 翻译完了 ChangeDetectorRef

This commit is contained in:
Zhicheng Wang 2018-09-04 15:32:26 +08:00
parent 3819d7de3b
commit 284e6a7319
2 changed files with 42 additions and 1 deletions

View File

@ -72,7 +72,7 @@
[x] | common/http/HttpResponse | 0.22
[x] | router/ActivatedRouteSnapshot | 0.22
[x] | common/http | 0.21
[ ] | core/ChangeDetectorRef | 0.21
[x] | core/ChangeDetectorRef | 0.21
[ ] | router/NavigationStart | 0.21
[ ] | common/formatDate | 0.21
[ ] | core/ComponentFactoryResolver | 0.20

View File

@ -12,38 +12,60 @@
* Use the methods to add and remove views from the tree, initiate change-detection,
* and explicitly mark views as _dirty_, meaning that they have changed and need to be rerendered.
*
* Angular
*
* 使**
*
* @usageNotes
*
* The following examples demonstrate how to modify default change-detection behavior
* to perform explicit detection when needed.
*
* 便
*
* ### Use `markForCheck()` with `CheckOnce` strategy
*
* ### 使 `markForCheck()` `CheckOnce`
*
* The following example sets the `OnPush` change-detection strategy for a component
* (`CheckOnce`, rather than the default `CheckAlways`), then forces a second check
* after an interval. See [live demo](http://plnkr.co/edit/GC512b?p=preview).
*
* `OnPush` `CheckOnce` `CheckAlways`
* [线](http://plnkr.co/edit/GC512b?p=preview)。
*
* <code-example path="core/ts/change_detect/change-detection.ts"
* region="mark-for-check"></code-example>
*
* ### Detach change detector to limit how often check occurs
*
* ###
*
* The following example defines a component with a large list of read-only data
* that is expected to change constantly, many times per second.
* To improve performance, we want to check and update the list
* less often than the changes actually occur. To do that, we detach
* the component's change detector and perform an explicit local check every five seconds.
*
*
*
*
*
* <code-example path="core/ts/change_detect/change-detection.ts" region="detach"></code-example>
*
*
* ### Reattaching a detached component
*
* ###
*
* The following example creates a component displaying live data.
* The component detaches its change detector from the main change detector tree
* when the `live` property is set to false, and reattaches it when the property
* becomes true.
*
*
* `live` `false` `true`
*
* <code-example path="core/ts/change_detect/change-detection.ts" region="detach"></code-example>
*
*/
@ -53,10 +75,14 @@ export abstract class ChangeDetectorRef {
* change detection strategy, explicitly marks the view as changed so that
* it can be checked again.
*
* 使 {@link ChangeDetectionStrategy#OnPush OnPush}`checkOnce`便
*
* Components are normally marked as dirty (in need of rerendering) when inputs
* have changed or events have fired in the view. Call this method to ensure that
* a component is checked even if these triggers have not occured.
*
* 使
*
* <!-- TODO: Add a link to a chapter on OnPush components -->
*
*/
@ -67,9 +93,15 @@ export abstract class ChangeDetectorRef {
* A detached view is not checked until it is reattached.
* Use in combination with `detectChanges()` to implement local change detection checks.
*
*
*
* `detectChanges()` 使
*
* Detached views are not checked during change detection runs until they are
* re-attached, even if they are marked as dirty.
*
* 使
*
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
* <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
*
@ -81,6 +113,8 @@ export abstract class ChangeDetectorRef {
* detach}
* to implement local change detection checks.
*
* {@link ChangeDetectorRef#detach detach} 使
*
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
* <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
*
@ -90,8 +124,12 @@ export abstract class ChangeDetectorRef {
/**
* Checks the change detector and its children, and throws if any changes are detected.
*
*
*
* Use in development mode to verify that running change detection doesn't introduce
* other changes.
*
*
*/
abstract checkNoChanges(): void;
@ -99,6 +137,9 @@ export abstract class ChangeDetectorRef {
* Re-attaches the previously detached view to the change detection tree.
* Views are attached to the tree by default.
*
*
*
*
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
*
*/