Title: Report bindings that have no effect on ng-container, ng-template, and ng-content · Issue #71881 · angular/angular · GitHub
Open Graph Title: Report bindings that have no effect on ng-container, ng-template, and ng-content · Issue #71881 · angular/angular
X Title: Report bindings that have no effect on ng-container, ng-template, and ng-content · Issue #71881 · angular/angular
Description: Which @angular/* package(s) are relevant/related to the feature request? compiler, compiler-cli, core Description
Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? compiler, compiler-cli, core Description
X Description: Which @angular/* package(s) are relevant/related to the feature request? compiler, compiler-cli, core Description <ng-container>, <ng-template>, and <ng-content> don't render ...
Opengraph URL: https://github.com/angular/angular/issues/71881
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Report bindings that have no effect on ng-container, ng-template, and ng-content","articleBody":"### Which @angular/\\* package(s) are relevant/related to the feature request?\n\ncompiler, compiler-cli, core\n\n### Description\n\n`\u003cng-container>`, `\u003cng-template>`, and `\u003cng-content>` don't render an element. Angular accepts\nbindings and attributes on them that can never take effect, and most of them compile and run\nwithout a word:\n\n```html\n\u003cng-container class=\"card\" [class.active]=\"isActive\" (click)=\"select()\">...\u003c/ng-container>\n\u003cng-template [title]=\"label\" (click)=\"missing()\">...\u003c/ng-template>\n\u003cng-content selector=\"h1\" />\n```\n\nNothing on these lines does anything:\n\n- Class, style, and event bindings on `\u003cng-container>` and `\u003cng-template>` are ignored, unless a\n directive claims them.\n- Bindings that no directive claims on `\u003cng-template>` aren't type-checked, so\n `(click)=\"missing()\"` compiles.\n- `\u003cng-content>` ignores every binding, and every attribute except `select` and `ngProjectAs`. The\n `selector` typo (for `select`) silently makes the slot a default slot. Angular's own upgrade\n examples have had this typo since 2017.\n- `NO_ERRORS_SCHEMA` hides unknown properties on `\u003cng-container>`, although no schema can give it\n a property.\n- Inside `\u003csvg>`, `[attr.x]` on `\u003cng-container>` skips its parse error and throws a misleading\n assertion in dev mode.\n\n### Proposed solution\n\nReport what Angular ignores, and nothing that takes effect. Code generation and runtime behavior\ndon't change.\n\n**Step 1, not breaking:**\n\n- **NG8031 `ignoredBinding`**, a new type-check diagnostic. It needs\n `strictTemplates`, is a warning by default, and is configured through\n `extendedDiagnostics.checks`, like NG8011. It reports class, style, `attr.`, animation, and\n event bindings that no directive claims, every binding on `\u003cng-content>`, and static attributes\n that nothing reads.\n- **NG8032**, a template type-check warning for a component whose selector matches\n `\u003cng-container>` or `\u003cng-template>`. That compiles today and fails only when the template\n renders, in dev and production mode.\n- The language service stops suggesting DOM attributes on `\u003cng-container>`.\n- **NG0319**, a dev-mode runtime log for class, style, and event bindings on `\u003cng-container>` and\n `\u003cng-template>`, so JIT is covered too.\n- The `\u003csvg>` parse fix.\n\n**Step 2, breaking:** severities only, in two independent PRs.\n\n- NG8032 is an error.\n- NG8031 is an error by default, and NG0319 throws under `errorOnUnknownProperties`.\n\nEvery new error points at a binding or component that never worked. NG8031 can be set back to\n`\"warning\"` or `\"suppress\"`.\n\nNot reported: bindings a directive claims, directive host bindings (directives are reusable),\nglobal event targets, and static attributes that a directive, a structural directive, a content\nprojection slot, or Angular itself reads.\n\nQuestion for the team: are the step 2 PRs fine for a minor release, or should they wait for a\nmajor? They can land separately.\n\nPRs: #71882 (step 1); #71883 (NG8032 error) and #71884 (NG8031 error), each building on #71882\n\n### Alternatives considered\n\n- **A template parse error.** The linker re-parses published libraries, so a parse error would\n break libraries that compile today.\n- **Only an extended diagnostic.** It can warn, but step 2 needs the same check in the type\n checker. One check in the type checker serves both levels.\n- **Only a runtime error.** It reports late, in dev mode only, and can't see bindings on\n `\u003cng-content>` or which static attributes something reads.\n- **Also reporting directive host bindings.** A directive can apply to elements where those\n bindings work, so reporting them would be noise.\n","author":{"url":"https://github.com/Flarette","@type":"Person","name":"Flarette"},"datePublished":"2026-11-08T17:02:02Z","url":"https://github.com/angular/angular/issues/71881"}
| 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:0a61db02-d49d-1483-09c3-ef2646733b1e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A6B4:19F84C:FAE3D7:141FEA3:6B00FDFA |
| html-safe-nonce | 59361fdd63518fb2fe1db561eaccaef00f5011e3c7589f4f53fadddf6684fb3d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNkI0OjE5Rjg0QzpGQUUzRDc6MTQxRkVBMzo2QjAwRkRGQSIsInZpc2l0b3JfaWQiOiI2OTY0MTQxMTkyODA4MzAwMDI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 588b051a05e4bc91111524aa57d20398790ad20cc26850bfc2ba707a7587a949 |
| hovercard-subject-tag | issue:6273351105 |
| 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/71881/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9f155549b95baef9ab62aeb814a8d204910313cfe8367a269892eb33b6fb403b/angular/angular/issues/71881 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9f155549b95baef9ab62aeb814a8d204910313cfe8367a269892eb33b6fb403b/angular/angular/issues/71881 |
| og:image:alt | Which @angular/* package(s) are relevant/related to the feature request? compiler, compiler-cli, core Description |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Flarette |
| hostname | github.com |
| expected-hostname | github.com |
| None | e208d86428ec00a57ade75058166297440e8128a01e5287c31a53dc042bbf187 |
| 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 | 7dafd017fb7809a839c443dba08622af38e63c09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width