{ "id": "api/common/NgSwitchCase", "title": "NgSwitchCase", "contents": "\n\n
\n
\n
\n \n API > @angular/common\n
\n \n
\n \n
\n

NgSwitchCaselink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

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

\n\n \n
\n \n \n \n \n
\n

See alsolink

\n \n
\n\n\n

NgModulelink

\n\n\n\n \n
\n

Selectorslink

\n \n \n \n
\n\n\n\n \n\n
\n

Propertieslink

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
PropertyDescription
\n \n @Input()
ngSwitchCase: any
\n
\n \n

Stores the HTML template to be selected on match.

\n\n \n
\n
\n\n\n\n \n\n\n \n
\n

Descriptionlink

\n \n

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

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

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

\n

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

\n\n
\n \n\n \n\n \n\n \n\n
\n

Methodslink

\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n\n \n \n
\n
\n

\n ngDoCheck()\n \n link

\n \n
\n
\n

Performs case matching. For internal use only.

\n\n
\n
\n \n\n ngDoCheck()\n\n \n\n
Parameters
\n

There are no parameters.

\n\n \n\n\n \n\n \n
\n
\n\n \n
\n\n \n \n \n\n
\n
\n\n\n" }