I have the following ngSwitch:
<p ng-switch="status"> <span ng-switch-when="wrong|incorrect"> Wrong </span> <span ng-switch-default> Correct </span> </p>
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 ?
Answer
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 https://github.com/angular/angular.js/issues/3410 Note, based on my experience it doesn’t work with numbers…yet?