YouTip LogoYouTip

Ng Ng Switch

# AngularJS `ng-switch` Directive [![Image 3: AngularJS Reference Manual](#) AngularJS Reference Manual](#) * * * Display the corresponding section based on the selected value:

Welcome to

Google

Welcome to Google

Taobao

Welcome to Taobao

Switch

Select different options to display corresponding values.

[Try it Β»](#) * * * ## Definition and Usage The **ng-switch** directive shows or hides the corresponding section based on an expression. Corresponding child elements use the **ng-switch-when** directive. If they match the selection, they are displayed; otherwise, they are removed. You can set a default option using the **ng-switch-default** directive. If no matches are found, the default option will be displayed. * * * ## Syntax The element supports this attribute. * * * ## Parameter Values | Value | Description | | --- | --- | | _expression_ | The expression that causes matching items to be displayed and non-matching items to be removed. | * * AngularJS Reference Manual](#)
← Pr Text Text TransformNg Ng Switch β†’