[Angularjs]ng-switch Usage

Source: Internet
Author: User

Usage description

Ng-switch is displayed based on the value of an expression or this hides the corresponding part. Similar to the switch usage in C # or other previews. can be slowly realized.

Says Ng-switch is going to talk about how the child element should change according to the current value. A child element can be hidden or displayed by means of the: ng-switch-when instruction, Ng-switch-default instruction to set the condition to be met. It is also easy to understand when, or when, the default value. Let's look at an example below.

Example
<SelectNg-model= "Myselect">    <optionvalue= "One">Select a</option>    <optionvalue= "both">Select two</option>    <optionvalue= "three">Choose Three</option></Select><DivNg-switch= "Myselect">    <DivNg-switch-when= "One">        <H1>One</H1>        <P>You chose one.</P>    </Div>    <DivNg-switch-when= "both">        <H1>Both</H1>        <P>You chose both.</P>    </Div>    <DivNg-switch-when= "three">        <H1>Three</H1>        <P>You chose three.</P>    </Div></Div>

Results

[Angularjs]ng-switch Usage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.