Title: Document NG0303 diagnostic when an unknown binding is present in a template · Issue #59488 · angular/angular · GitHub
Open Graph Title: Document NG0303 diagnostic when an unknown binding is present in a template · Issue #59488 · angular/angular
X Title: Document NG0303 diagnostic when an unknown binding is present in a template · Issue #59488 · angular/angular
Description: Which @angular/* package(s) are relevant/related to the feature request? compiler Description Hi ! Doing large scale 'legacy' migration through SAC / CF I came over this potential optimization that might help us improve the DX slightly. ...
Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? compiler Description Hi ! Doing large scale 'legacy' migration through SAC / CF I came over this potential optimization that...
X Description: Which @angular/* package(s) are relevant/related to the feature request? compiler Description Hi ! Doing large scale 'legacy' migration through SAC / CF I came over this potential optimizat...
Opengraph URL: https://github.com/angular/angular/issues/59488
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Document NG0303 diagnostic when an unknown binding is present in a template","articleBody":"### Which @angular/* package(s) are relevant/related to the feature request?\n\ncompiler\n\n### Description\n\nHi ! \n\nDoing large scale 'legacy' migration through SAC / CF I came over this potential optimization that might help us improve the DX slightly. Currently if a component template has `NgTemplateOutlet` while the respective `component.imports` array is missing the import of the directive, the app compiles successfully and the app might have a leaking issue that might only be caught during QA testing at runtime (supposing the respective existing component does not have properly test). I would rather expect the app to compile-time fail as it does when the aforementioned template is using something like `NgClass` while the respective import is missing, as this will yield `NG8002` in case of missing `NgClass` import.\n\n```\n\nimport { NgClass } from '@angular/common';\nimport { Component } from '@angular/core';\n\n@Component({\n selector: 'app-root',\n standalone: true,\n imports: [NgClass],\n template: `\n \u003c!--Remove the import of NgTemplateOutlet and the compilation will succeed-->\n \u003cng-container *ngTemplateOutlet=\"ref\"/>\n \u003cng-template #ref> \u003ch1>can you make me fail during app compilation with NG0303 as I am compiling successfully ?\u003c/h1> \u003c/ng-template>\n\n \u003c!--Remove the import of NgClass and the compilation will fail-->\n \u003ch1 [ngClass]=\"show ? 'blue' : 'default'\">Missing NgClass will yield NG8002 \u003c/h1>\n `,\n styles: [`\n .blue {\n color: blue; \n }\n .default {\n color: black;\n }\n `]\n})\nexport class AppComponent {\n title = 'repro';\n show = true; \n}\n```\n\nRepo: https://github.com/bougwal/NG0303 \n\n\n\n\n### Proposed solution\n\n\nI am thus, asking for: \n- The potential improvement of making `NG0303` compile time failure if there are no blockers/concerns. \n- The addition of `NG0303` to the error encyclopaedia, as I don't see it logged on ADEV neither under runtime nor under compile time: https://angular.dev/errors. Is there a reason to exclude it? \n\nLet me know if I am missing smth I have to add / I look forward to the input / more context on this ! \n\nMany thanks guys ! \n\n### Alternatives considered\n\nn/a","author":{"url":"https://github.com/bougwal","@type":"Person","name":"bougwal"},"datePublished":"2025-01-12T13:13:34Z","url":"https://github.com/angular/angular/issues/59488"}
| 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:9458256c-4532-2489-c410-6d584a5bd34c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B9BC:25598F:BF6B2D:FE68FC:6B00F376 |
| html-safe-nonce | 3fa6df27b14584ea88c5175ecef526dd70e00cfc7ba289e426f16a1ea0275ef3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOUJDOjI1NTk4RjpCRjZCMkQ6RkU2OEZDOjZCMDBGMzc2IiwidmlzaXRvcl9pZCI6IjQzOTk1ODE2MjQ0MDUxMjgwNTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ccefd9e328a66cf8a40181c2c0c76413e9bbc64384e108ba5ec0862a8f64a1b0 |
| hovercard-subject-tag | issue:2782479933 |
| 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/59488/issue_layout |
| twitter:image | https://opengraph.githubassets.com/36a7c9eaef740bea5f835d4e4616e8eadffb7794803a0a15e8fc26fe877a98b4/angular/angular/issues/59488 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/36a7c9eaef740bea5f835d4e4616e8eadffb7794803a0a15e8fc26fe877a98b4/angular/angular/issues/59488 |
| og:image:alt | Which @angular/* package(s) are relevant/related to the feature request? compiler Description Hi ! Doing large scale 'legacy' migration through SAC / CF I came over this potential optimization that... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bougwal |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width