ngSwitchCase directive does not work with multiple values
See original GitHub issueI’m submitting a … (check one with “x”)
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Using multiple values as an expression in the ngSwitchCase directive only works with the first value and does not give any errors.
Expected behavior
Show view when ngSwitch
matches second value of the ngSwitchCase
expression.
Minimal reproduction of the problem with instructions
<div [ngSwitch]="status">
<div *ngSwitchCase="statusEnum.Loaded || statusEnum.Selected">
<p>I should show up when status is either Loaded or Selected!
</div>
</div>
What is the motivation / use case for changing the behavior?
Make everyone happy who need to use multiple values.
Please tell us about your environment:
Windows 10
-
Angular version: 2.0.1
-
Browser: [all]
-
Language: [all]
-
Node (for AoT issues):
node --version
=
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Two switch case values in angular - Stack Overflow
Option 1 is using the directive *ngSwitchDefault , but this will only work if all your multiple cases are FORM 1: <div [ngSwitch]="data.type">...
Read more >NgSwitchCase - Angular
When the expressions match, the given NgSwitchCase template is rendered. If multiple match expressions match the switch expression value, all of them are...
Read more >Angular 14 NgSwitch Directive Tutorial with Examples
It gets the switch value based on the matched statement among multiple possibilities. ngSwitchCase, The ngSwitchCase statement is declared ...
Read more >ngSwitch, ngSwitchcase, ngSwitchDefault Angular Example
The ngSwitch is an Angular directive, which allows us to display one or more DOM elements based on some pre-defined condition. The following...
Read more >NgIf & NgSwitch • Angular - codecraft.tv
We can't have two structural directives, directives starting with a *, attached to the same element. The below code would not work: HTML....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Needa quote string is pretty dumb…
@ogix http://stackoverflow.com/a/40177408/5497460 There is a solution.