Questions tagged [ng-switch]

The ngSwitch directive is used to conditionally swap DOM structure on your template based on a scope expression. Elements within ngSwitch but without ngSwitchWhen or ngSwitchDefault directives will be preserved at the location as specified in the template.

Usage

<ANY ng-switch="expression">
  <ANY ng-switch-when="matchValue1">...</ANY>
  <ANY ng-switch-when="matchValue2">...</ANY>
  <ANY ng-switch-default>...</ANY>
</ANY>
197 questions
-1
votes
1 answer

Angular ng-switch with conditions

I have ng-switch="field.type" for an element containing ng-switch-when but I'd like to have the switch on when it's more than just one field.type. I would assume something like ng-switch-when="type1 || type2" would work, but it doesn't. What's the…
Reuben
  • 2,701
  • 6
  • 31
  • 47
-2
votes
1 answer

Understanding NgSwitch in angular2

Hello i got an error as i am trying to learn angular2. I decided to have a go at replacing child components within a parent component. Both child component A and B will replace each other using the in built ngSwitch. But i got an error complaining…
EI-01
  • 1,075
  • 3
  • 24
  • 42
1 2 3
13
14