Title: NG8011 isn't reported when a `@boundary` block prevents a node from being projected · Issue #71288 · angular/angular · GitHub
Open Graph Title: NG8011 isn't reported when a `@boundary` block prevents a node from being projected · Issue #71288 · angular/angular
X Title: NG8011 isn't reported when a `@boundary` block prevents a node from being projected · Issue #71288 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? compiler-cli, compiler Is this a regression? No Description Like @if, @for and @switch, a @boundary block copies the tag name and attributes of its single root node, so that node can...
Open Graph Description: Which @angular/* package(s) are the source of the bug? compiler-cli, compiler Is this a regression? No Description Like @if, @for and @switch, a @boundary block copies the tag name and attributes o...
X Description: Which @angular/* package(s) are the source of the bug? compiler-cli, compiler Is this a regression? No Description Like @if, @for and @switch, a @boundary block copies the tag name and attributes o...
Opengraph URL: https://github.com/angular/angular/issues/71288
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NG8011 isn't reported when a `@boundary` block prevents a node from being projected","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\ncompiler-cli, compiler\n\n### Is this a regression?\n\nNo\n\n### Description\n\nLike `@if`, `@for` and `@switch`, a `@boundary` block copies the tag name and attributes of its single root node, so that node can be projected into a specific `ng-content` slot. When the block has more than one root node, the node goes to the default slot instead. NG8011 (`controlFlowPreventingContentProjection`) warns about this for the other blocks, but not for `@boundary`.\n\n```ts\n@Component({\n selector: 'app-card',\n template: `\n \u003cdiv class=\"body\">\u003cng-content />\u003c/div>\n \u003cdiv class=\"title\">\u003cng-content select=\"[card-title]\" />\u003c/div>\n `,\n})\nexport class Card {}\n```\n\n```html\n\u003capp-card>\n @boundary {\n \u003ch2 card-title>Title\u003c/h2>\n \u003cp>Subtitle\u003c/p>\n } @error {\n \u003cp>Could not load the card.\u003c/p>\n }\n\u003c/app-card>\n```\n\n`\u003ch2 card-title>` ends up in `.body` instead of `.title`, and nothing is reported. With `@if (true)` in place of `@boundary`, the same template gets the NG8011 warning.\n\n`TcbControlFlowContentProjectionOp.findPotentialControlFlowNodes` (`packages/compiler/src/typecheck/ops/content_projection.ts`) only collects `@if`, `@for` and `@switch` blocks. `@boundary` came later (#70463) and the diagnostic wasn't updated.\n\nA related difference I noticed: `@error` blocks don't copy the tag name and attributes of their root node at all. `ingestBoundaryBlock` only does it for the main block, and the `BoundaryErrorCreate` op is emitted with a `null` tag and attributes. So a lone `\u003cspan card-title>` inside `@error` goes to the default slot, while it goes to the right slot inside an `@else`. I'm not sure whether that's intended, so I've kept it out of the fix.\n\n#71289 has the fix and tests.\n\n### Please provide a link to a minimal reproduction of the bug\n\nNo hosted reproduction, but this is self-contained (compiled with `strictTemplates: true`):\n\n```ts\nimport {Component} from '@angular/core';\nimport {bootstrapApplication} from '@angular/platform-browser';\n\n@Component({\n selector: 'app-card',\n template: `body: [\u003cng-content />] title: [\u003cng-content select=\"[card-title]\" />]`,\n})\nexport class Card {}\n\n@Component({\n selector: 'app-root',\n imports: [Card],\n template: `\n \u003capp-card>\n @boundary {\n \u003ch2 card-title>Title\u003c/h2>\n \u003cp>Subtitle\u003c/p>\n } @error {\n \u003cp>Could not load the card.\u003c/p>\n }\n \u003c/app-card>\n `,\n})\nexport class App {}\n\nbootstrapApplication(App);\n```\n\nThe compiler doesn't report anything, and the page shows the title inside `body: [...]`.\n\n### Please provide the exception or error you saw\n\n```true\nNo diagnostic. With `@if (true)` instead of `@boundary`, the compiler reports:\n\nwarning NG8011: Node matches the \"[card-title]\" slot of the \"Card\" component, but will not be projected into the specific slot because the surrounding @if has more than one node at its root.\n```\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\nReproduced on the main branch of angular/angular (458f1d76b8).\n```\n\n### Anything else?\n\n_No response_\n","author":{"url":"https://github.com/aminesbdev","@type":"Person","name":"aminesbdev"},"datePublished":"2026-10-10T19:02:52Z","url":"https://github.com/angular/angular/issues/71288"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e27df4b4-0fda-8cae-e027-47a11bf90f6c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D1C4:5F221:1481C6:1C83A4:6AFDD947 |
| html-safe-nonce | 6a3c6b08b60193aa8b4a28a3d41d75e4719fc4ebb06b6afb09535b2ee3323cf5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUM0OjVGMjIxOjE0ODFDNjoxQzgzQTQ6NkFGREQ5NDciLCJ2aXNpdG9yX2lkIjoiNzc1MjM2NDkzODI3MzYxMDA1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b38e3505ed5c8a733af3f9a0220393069a93cbe59052d5d965bf1ebd27e67a39 |
| hovercard-subject-tag | issue:5794351530 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/71288/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0f2051c1d664f3cd82303c4f14275bfbf26d4c212fc3110e668b2f24deaa8bf7/angular/angular/issues/71288 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0f2051c1d664f3cd82303c4f14275bfbf26d4c212fc3110e668b2f24deaa8bf7/angular/angular/issues/71288 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? compiler-cli, compiler Is this a regression? No Description Like @if, @for and @switch, a @boundary block copies the tag name and attributes o... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aminesbdev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9918bd4004419458bcd838065ac2a76b76ebd11705d73909fff5ab99e996fa23 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a231c174493a6a442c0b0544475c918b30128208 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width