angularjs: multiple values in a ng-switch-when

I have the following ngSwitch:

<p ng-switch="status">
    <span ng-switch-when="wrong|incorrect">
    <span ng-switch-default>

As you can see, I have the text Wrong for two options wrong and correct. I have tried (as you can see) to use the pipe |, but that doesn’t work. Any suggestions ?


For angular >=v1.5.10,

You can do it by adding ng-switch-when-separator="|" to ng-switch-when node. see example in documentation.

<span ng-switch-when="wrong|incorrect" ng-switch-when-separator="|">

see discussion here Note, based on my experience it doesn’t work with numbers…yet?

Leave a Reply

Your email address will not be published. Required fields are marked *