Skip to content

Conversation

@JeanMeche
Copy link
Member

@JeanMeche JeanMeche commented Dec 20, 2025

Happy Hollidays & Merry Christmas 🎅🏻 🎄

Consecutive @case blocks are now supported:

@switch (case) {
  @case (0)
  @case (1) {
    <div>case 0 or 1</div>
  }
  @case (2) {
    <div>case 2</div>
  }
  @default {
    <div>default</div>
  }
}

fixes #14659

@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: compiler Issues related to `ngc`, Angular's template compiler labels Dec 20, 2025
@ngbot ngbot bot added this to the Backlog milestone Dec 20, 2025
@JeanMeche JeanMeche force-pushed the multiple-case branch 5 times, most recently from 1540e9a to 35b358c Compare December 20, 2025 16:21
Copy link
Contributor

@atscott atscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to make sure you update the textmate scopes for syntax highlighting

@JeanMeche JeanMeche force-pushed the multiple-case branch 6 times, most recently from 6800e13 to d9420a1 Compare December 20, 2025 19:07
consecutive `@case` blocks are now supported:

```ts
@switch (case) {
  @case (0)
  @case (1) {
    case 0 or 1
  }
  @case (2) {
    case 2
  }
  @default {
    default
  }
}
```

fixes angular#14659
export class SwitchBlockCase extends BlockNode implements Node {
constructor(
public expression: AST | null,
public expressions: AST[],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or should we prefer AST[] | null and the array always has at least 1 element ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: compiler Issues related to `ngc`, Angular's template compiler detected: feature PR contains a feature commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: support multiple case matching in ngSwitch/@switch

2 participants