docs(API): 翻译完了 NgTemplateOutlet

This commit is contained in:
Zhicheng Wang 2018-09-04 08:43:00 +08:00
parent 6292866c98
commit eb075b665f
2 changed files with 21 additions and 1 deletions

View File

@ -43,7 +43,7 @@
[x] | core/HostListener | 0.47 [x] | core/HostListener | 0.47
[x] | common/AsyncPipe | 0.45 [x] | common/AsyncPipe | 0.45
[x] | core/ViewContainerRef | 0.42 [x] | core/ViewContainerRef | 0.42
[ ] | common/NgTemplateOutlet | 0.42 [x] | common/NgTemplateOutlet | 0.42
[ ] | common/Location | 0.41 [ ] | common/Location | 0.41
[ ] | platform-browser/BrowserModule | 0.40 [ ] | platform-browser/BrowserModule | 0.40
[ ] | common/DecimalPipe | 0.40 [ ] | common/DecimalPipe | 0.40

View File

@ -20,14 +20,23 @@ import {Directive, EmbeddedViewRef, Input, OnChanges, SimpleChange, SimpleChange
* *
* Inserts an embedded view from a prepared `TemplateRef`. * Inserts an embedded view from a prepared `TemplateRef`.
* *
* `TemplateRef`
*
* You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`. * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
* `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
* by the local template `let` declarations. * by the local template `let` declarations.
* *
* `[ngTemplateOutletContext]` `EmbeddedViewRef`
* `[ngTemplateOutletContext]` key 使 `let`
*
* Note: using the key `$implicit` in the context object will set its value as default. * Note: using the key `$implicit` in the context object will set its value as default.
* *
* 使 `$implicit` key
*
* ## Example * ## Example
* *
* ##
*
* {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'} * {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
* *
* *
@ -66,13 +75,24 @@ export class NgTemplateOutlet implements OnChanges {
/** /**
* We need to re-create existing embedded view if: * We need to re-create existing embedded view if:
*
*
*
* - templateRef has changed * - templateRef has changed
*
* templateRef
*
* - context has changes * - context has changes
* *
* context
*
* We mark context object as changed when the corresponding object * We mark context object as changed when the corresponding object
* shape changes (new properties are added or existing properties are removed). * shape changes (new properties are added or existing properties are removed).
* In other words we consider context with the same properties as "the same" even * In other words we consider context with the same properties as "the same" even
* if object reference changes (see https://github.com/angular/angular/issues/13407). * if object reference changes (see https://github.com/angular/angular/issues/13407).
*
*
* 使 "相同的" <https://github.com/angular/angular/issues/13407>
*/ */
private _shouldRecreateView(changes: SimpleChanges): boolean { private _shouldRecreateView(changes: SimpleChanges): boolean {
const ctxChange = changes['ngTemplateOutletContext']; const ctxChange = changes['ngTemplateOutletContext'];