填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

NgSwitchCase

Provides a switch case expression to match against an enclosing ngSwitch expression. When the expressions match, the given NgSwitchCase template is rendered. If multiple match expressions match the switch expression value, all of them are displayed.

参见

NgModule

选择器

属性

属性说明
@Input()
ngSwitchCase: any

Stores the HTML template to be selected on match.

说明

Within a switch container, *ngSwitchCase statements specify the match expressions as attributes. Include *ngSwitchDefault as the final case.

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

Each switch-case statement contains an in-line HTML template or template reference that defines the subtree to be selected if the value of the match expression matches the value of the switch expression.

Unlike JavaScript, which uses strict equality, Angular uses loose equality. This means that the empty string, "" matches 0.

方法

Performs case matching. For internal use only.

ngDoCheck()
      
      ngDoCheck()
    
参数

没有参数。