docs(API): 翻译完了 NgSwitch

This commit is contained in:
Zhicheng Wang 2018-09-02 22:09:03 +08:00
parent 6312e38a63
commit fe5c6d0a11
2 changed files with 31 additions and 3 deletions

View File

@ -37,7 +37,7 @@
[x] | forms/Validators | 0.59 [x] | forms/Validators | 0.59
[x] | common/http/HttpHeaders | 0.56 [x] | common/http/HttpHeaders | 0.56
[x] | core/Pipe | 0.52 [x] | core/Pipe | 0.52
[ ] | common/NgSwitch | 0.52 [x] | common/NgSwitch | 0.52
[ ] | forms/NgForm | 0.50 [ ] | forms/NgForm | 0.50
[ ] | core/Renderer2 | 0.49 [ ] | core/Renderer2 | 0.49
[x] | core/HostListener | 0.47 [x] | core/HostListener | 0.47
@ -98,7 +98,7 @@
[ ] | forms/ValidatorFn | 0.17 [ ] | forms/ValidatorFn | 0.17
[ ] | http/RequestOptionsArgs | 0.17 [ ] | http/RequestOptionsArgs | 0.17
[ ] | animations/animation | 0.17 [ ] | animations/animation | 0.17
[ ] | common/NgSwitchCase | 0.16 [x] | common/NgSwitchCase | 0.16
[ ] | core/testing/async | 0.16 [ ] | core/testing/async | 0.16
## 翻译方式 ## 翻译方式

View File

@ -54,24 +54,41 @@ export class SwitchView {
* *
* Adds / removes DOM sub-trees when the nest match expressions matches the switch expression. * Adds / removes DOM sub-trees when the nest match expressions matches the switch expression.
* *
* match`match_express_*` switch`switch_expression` / DOM
*
* `NgSwitch` stamps out nested views when their match expression value matches the value of the * `NgSwitch` stamps out nested views when their match expression value matches the value of the
* switch expression. * switch expression.
* *
* `match` `switch` `NgSwitch` "印"
*
* In other words: * In other words:
*
*
*
* - you define a container element (where you place the directive with a switch expression on the * - you define a container element (where you place the directive with a switch expression on the
* `[ngSwitch]="..."` attribute) * `[ngSwitch]="..."` attribute)
*
* `[ngSwitch]="..."` `switch`
*
* - you define inner views inside the `NgSwitch` and place a `*ngSwitchCase` attribute on the view * - you define inner views inside the `NgSwitch` and place a `*ngSwitchCase` attribute on the view
* root elements. * root elements.
* *
* `NgSwitch` `*ngSwitchCase`
*
* Elements within `NgSwitch` but outside of a `NgSwitchCase` or `NgSwitchDefault` directives will * Elements within `NgSwitch` but outside of a `NgSwitchCase` or `NgSwitchDefault` directives will
* be preserved at the location. * be preserved at the location.
* *
* `NgSwitch` `NgSwitchCase` `NgSwitchDefault`
*
* The `ngSwitchCase` directive informs the parent `NgSwitch` of which view to display when the * The `ngSwitchCase` directive informs the parent `NgSwitch` of which view to display when the
* expression is evaluated. * expression is evaluated.
* When no matching expression is found on a `ngSwitchCase` view, the `ngSwitchDefault` view is * When no matching expression is found on a `ngSwitchCase` view, the `ngSwitchDefault` view is
* stamped out. * stamped out.
* *
* *
* `ngSwitchCase` `NgSwitch`
* `ngSwitchCase` `ngSwitchDefault`
*
*/ */
@Directive({selector: '[ngSwitch]'}) @Directive({selector: '[ngSwitch]'})
export class NgSwitch { export class NgSwitch {
@ -141,14 +158,20 @@ export class NgSwitch {
* given expression evaluate to respectively the same/different value as the switch * given expression evaluate to respectively the same/different value as the switch
* expression. * expression.
* *
* `switch` {@link NgSwitch}
*
* Insert the sub-tree when the expression evaluates to the same value as the enclosing switch * Insert the sub-tree when the expression evaluates to the same value as the enclosing switch
* expression. * expression.
* *
* `switch`
*
* If multiple match expressions match the switch expression value, all of them are displayed. * If multiple match expressions match the switch expression value, all of them are displayed.
* *
* `match` `switch`
*
* See {@link NgSwitch} for more details and example. * See {@link NgSwitch} for more details and example.
* *
* * {@link NgSwitch}
*/ */
@Directive({selector: '[ngSwitchCase]'}) @Directive({selector: '[ngSwitchCase]'})
export class NgSwitchCase implements DoCheck { export class NgSwitchCase implements DoCheck {
@ -182,11 +205,16 @@ export class NgSwitchCase implements DoCheck {
* Creates a view that is added to the parent {@link NgSwitch} when no case expressions * Creates a view that is added to the parent {@link NgSwitch} when no case expressions
* match the switch expression. * match the switch expression.
* *
* `case` `switch` {@link NgSwitch}
*
* Insert the sub-tree when no case expressions evaluate to the same value as the enclosing switch * Insert the sub-tree when no case expressions evaluate to the same value as the enclosing switch
* expression. * expression.
* *
* `case` `switch`
*
* See {@link NgSwitch} for more details and example. * See {@link NgSwitch} for more details and example.
* *
* {@link NgSwitch}
* *
*/ */
@Directive({selector: '[ngSwitchDefault]'}) @Directive({selector: '[ngSwitchDefault]'})