Title: Compiler doesn't report missing import for a directive applied on `ng-template` · Issue #69322 · angular/angular · GitHub
Open Graph Title: Compiler doesn't report missing import for a directive applied on `ng-template` · Issue #69322 · angular/angular
X Title: Compiler doesn't report missing import for a directive applied on `ng-template` · Issue #69322 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? compiler Is this a regression? Yes Description When using a standalone attribute directive in a template via property binding syntax (e.g., [myDirective]="value"), the Angular compil...
Open Graph Description: Which @angular/* package(s) are the source of the bug? compiler Is this a regression? Yes Description When using a standalone attribute directive in a template via property binding syntax (e.g., [m...
X Description: Which @angular/* package(s) are the source of the bug? compiler Is this a regression? Yes Description When using a standalone attribute directive in a template via property binding syntax (e.g., [m...
Opengraph URL: https://github.com/angular/angular/issues/69322
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Compiler doesn't report missing import for a directive applied on `ng-template`","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\ncompiler\n\n### Is this a regression?\n\nYes\n\n### Description\n\n- When using a standalone attribute directive in a template via property binding syntax (e.g., [myDirective]=\"value\"), the Angular compiler completely ignores the binding if the directive is forgotten in the @Component.imports array.\n\n- Even with strictTemplates: true and extended diagnostics enabled, the compiler does not throw an error or warning about an unknown property on standard HTML elements (like div), provided the bound expression is a method call or a valid property.\n\n### Please provide a link to a minimal reproduction of the bug\n\n_No response_\n\n### Please provide the exception or error you saw\n\n```true\nimport { Directive, Input } from '@angular/core';\n\n@Directive({\n selector: '[auiTypedOption]',\n standalone: true\n})\nexport class TypedOptionDirective {\n @Input() auiTypedOption: any;\n}\n\n\n\nimport { Component } from '@angular/core';\n\n@Component({\n selector: 'app-test',\n standalone: true,\n imports: [], // \u003c-- TypedOptionDirective is missing here\n template: `\n \u003cdiv [auiTypedOption]=\"searchResult()\">\u003c/div>\n `\n})\nexport class TestComponent {\n searchResult() {\n return { query: 'test' };\n }\n}\n\n\n\n{\n \"angularCompilerOptions\": {\n \"strictTemplates\": true,\n \"extendedDiagnostics\": {\n \"defaultCategory\": \"error\",\n \"checks\": {\n \"missingControlFlowDirective\": \"error\"\n }\n }\n }\n}\n```\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\nAngular CLI : 21.2.14\nAngular : 21.2.17\nNode.js : 24.16.0\nPackage Manager : npm 11.10.0\nOperating System : win32 x64\n\n┌───────────────────────────────┬───────────────────┬───────────────────┐\n│ Package │ Installed Version │ Requested Version │\n├───────────────────────────────┼───────────────────┼───────────────────┤\n│ @angular-devkit/build-angular │ 21.2.14 │ ^21.2.14 │\n│ @angular/build │ 21.2.14 │ ^21.2.14 │\n│ @angular/cli │ 21.2.14 │ 21.2.14 │\n│ @angular/common │ 21.2.17 │ 21.2.17 │\n│ @angular/compiler │ 21.2.17 │ 21.2.17 │\n│ @angular/compiler-cli │ 21.2.17 │ 21.2.17 │\n│ @angular/core │ 21.2.17 │ 21.2.17 │\n│ @angular/forms │ 21.2.17 │ 21.2.17 │\n│ @angular/language-service │ 21.2.17 │ 21.2.17 │\n│ @angular/localize │ 21.2.17 │ ^21.2.17 │\n│ @angular/platform-browser │ 21.2.17 │ 21.2.17 │\n│ @angular/router │ 21.2.17 │ 21.2.17 │\n│ @angular/service-worker │ 21.2.17 │ 21.2.17 │\n│ rxjs │ 7.8.2 │ ^7.8.2 │\n│ typescript │ 5.9.3 │ 5.9.3 │\n│ zone.js │ 0.16.2 │ ~0.16.2 │\n└───────────────────────────────┴───────────────────┴───────────────────┘\n```\n\n### Anything else?\n\nBecause TypedOptionDirective is not imported, the template compiler should evaluate [auiTypedOption] as a plain property binding on a div element. Since HTMLDivElement does not have a auiTypedOption property, strictTemplates should catch this and throw:\nNG8002: Can't bind to 'auiTypedOption' since it isn't a known property of 'div'.","author":{"url":"https://github.com/sysmat","@type":"Person","name":"sysmat"},"datePublished":"2026-06-12T05:28:39Z","url":"https://github.com/angular/angular/issues/69322"}
| 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:75de99e9-b513-87de-7543-9488bb4ab032 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E794:2DBB21:109BB4F:16253B6:6B01177B |
| html-safe-nonce | 821598a97d7d49bcf3105bcb5a3f39c61b94a803b13e774bbe9c8a4345343385 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzk0OjJEQkIyMToxMDlCQjRGOjE2MjUzQjY6NkIwMTE3N0IiLCJ2aXNpdG9yX2lkIjoiODQzMTE4MzEzNjQyNzE1MzI3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8500756b515852853e03abd886aad298a5737641f22c2bed89d4c91ad7e65721 |
| hovercard-subject-tag | issue:4646593377 |
| 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/69322/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5b5d9d82224f6d9cd08c2566f5f8bd32c3b87a4792a830eb28f2580f194953e2/angular/angular/issues/69322 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5b5d9d82224f6d9cd08c2566f5f8bd32c3b87a4792a830eb28f2580f194953e2/angular/angular/issues/69322 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? compiler Is this a regression? Yes Description When using a standalone attribute directive in a template via property binding syntax (e.g., [m... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sysmat |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width