Angular: Support @content block (#19431)

This commit is contained in:
fisker Cheung authored and GitHub committed 2026-06-23 20:01:45 +08:00
1 parent aadd3ee2b8
commit e736c0e858
5 files changed
+77 -3

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
#### Support `@content` block (#19431 by @fisker)
<!-- prettier-ignore -->
```html
<!-- Input -->
<FancyButton [label]="title">
@content(icon) {
<span>Icon</span>
}
@content(description) {
<span>Description text</span>
}
<span>Other children</span>
</FancyButton>
<!-- Prettier stable -->
SyntaxError: Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) (9:15)
<!-- Prettier main -->
<FancyButton [label]="title">
@content(icon) {
<span>Icon!</span>
}
@content(description) {
<span>Description text</span>
}
<span>Other children</span>
</FancyButton>
```