You can do it by adding ng-switch-when-separator="|" to ng-when node. You can't have multiple conditions with a single ng-switch-when. The ngSwitch directive is used to conditionally swap DOM structure on your template It is possible to associate multiple values to the same ngSwitchWhen by. It seems that as of AngularJS , you can now have multiple ngSwitchWhen cases bound to the same value in the context of a single ngSwitch.
Using multiple values as an expression in the ngSwitchCase directive only . New feature: ng-switch-when-separator in Angular 2 to allow multiple values #. New feature: ng-switch-when-separator in Angular 2 to allow multiple values # Open. peterhe opened this Issue on Feb 22, · 20 comments. ng-switch-on="value"> ng-switch-when="foo">foo ngSwitch): Allow multiple case matches for one element #
Example. Show a section of HTML, only if it matches a certain value: ng- switch="myVar"> ng-switch-when="dogs"> Dogs Welcome to a. Here we will learn ng-switch directive in angularjs with example, use of ng-switch in angularjs and how to use ng-switch with multiple when conditions with. The ngSwitch directive is used to conditionally swap DOM structure on your on which element matches the value obtained from the evaluated expression. Creates a view that will be added/removed from the parent NgSwitch when the If multiple match expressions match the switch expression value, all of them are.