angular.js - usage of angular ng-switch
某草草
某草草 2017-05-15 16:53:38
0
1
778

The code is as follows:

<p ng-switch="vm.status">
    <p ng-switch-when="1">
        <!--code-->
    </p>
    <p ng-switch-when="2">
        <!--code-->
    </p>
    <p ng-switch-when="3">
        <!--code-->
    </p>
    <p ng-switch-when="4">
        <!--code-->
    </p>
</p>

When the values ​​​​are 1 and 2, the output content is the same. Can it be merged at this time, such as this:

<p ng-switch="vm.status">
    <!--1和2时,合并在一起输出-->
    <p ng-switch-when="1||2">
        <!--code-->
    </p>
    <p ng-switch-when="3">
        <!--code-->
    </p>
    <p ng-switch-when="4">
        <!--code-->
    </p>
</p>

In js, if you don’t write break in switch, you can execute through it, but angular doesn’t know how to do it, and the tutorial doesn’t mention this either

某草草
某草草

reply all(1)
过去多啦不再A梦

ng-switch-when cannot have multiple values, but it can be modified,

http://stackoverflow.com/questions/22610543/angularjs-multiple-values-...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template