NgSwitchCase

如果指定的表达式的计算结果和 switch 表达式相同,就会在父指令 NgSwitch中创建一个视图;如果不同,则移除。

Creates a view that will be added/removed from the parent NgSwitchwhen the given expression evaluate to respectively the same/different value as the switch expression.

查看"说明"...

NgModule

选择器

属性

属性说明
@Input()
ngSwitchCase: any

说明

当表达式求值的结果与 switch 表达式相同,则插入该子树。

Insert the sub-tree when the expression evaluates to the same value as the enclosing switch expression.

如果多个 match 表达式都与 switch 表达式的结果相匹配,就全都显示它们。

If multiple match expressions match the switch expression value, all of them are displayed.

参见 NgSwitch了解详情并查看例子。

See NgSwitchfor more details and example.

<container-element [ngSwitch]="switch_expression"> <some-element *ngSwitchCase="match_expression_1">...</some-element> </container-element>
      
      <container-element [ngSwitch]="switch_expression">
  <some-element *ngSwitchCase="match_expression_1">...</some-element>
</container-element>
    

方法

ngDoCheck()
      
      ngDoCheck()
    
参数

没有参数。