1

Like what we have in C# (mutliple values with the same output)

switch (CommandId)
                {
                    case 1:
                    case 2:
                      .
                      .
                      .
                        {
                            return "test";
                        }
                 }

I want to have 2 or more cases with the same output in angularjs

  <div ng-switch="ctrl.Step">
     <button class="md-raised md-primary" ng-switch-when="1" ng-click="ctrl.save()">
              Save
     </button>
     <button class="md-raised md-primary" ng-switch-when="2" ng-click="ctrl.save()">
              Save
     </button>
 </div>

What is the syntax for such code?

1 Answer 1

1

you can do it with the ng-switch-when-separator, please look at the doc.

<div ng-switch="ctrl.Step">
     <button class="md-raised md-primary" ng-switch-when="1|2" ng-switch-when-separator="|" ng-click="ctrl.save()">
              Save
     </button>
 </div>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.