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

NgSwitchCase

提供一个 switch case 表达式来匹配一个封闭的 ngSwitch 表达式。当表达式匹配时,将渲染给定的 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.

参见

Exported from

选择器

属性

属性说明
@Input()
ngSwitchCase: any

存储要在匹配时选择的 HTML 模板。

Stores the HTML template to be selected on match.

说明

在开关容器中, *ngSwitchCase 语句将匹配表达式指定为属性。包括用 *ngSwitchDefault 作为最后一种情况。

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>
    

每个 switch-case 语句包含一个内联 HTML 模板或模板引用,该模板或模板引用定义了 match 表达式的值与 switch 表达式的值匹配时要选择的子树。

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.

与 JavaScript 使用严格相等性的方式不同,Angular 使用宽松相等性。这意味着空字符串 "" 能匹配 0。

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()
    
参数

没有参数。