Repository navigation
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 compiler completely ignores the binding if the directive is forgotten in the @Component.imports array.
-
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.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
import { Directive, Input } from '@angular/core';
@Directive({
selector: '[auiTypedOption]',
standalone: true
})
export class TypedOptionDirective {
@Input() auiTypedOption: any;
}
import { Component } from '@angular/core';
@Component({
selector: 'app-test',
standalone: true,
imports: [], // <-- TypedOptionDirective is missing here
template: `
<div [auiTypedOption]="searchResult()"></div>
`
})
export class TestComponent {
searchResult() {
return { query: 'test' };
}
}
{
"angularCompilerOptions": {
"strictTemplates": true,
"extendedDiagnostics": {
"defaultCategory": "error",
"checks": {
"missingControlFlowDirective": "error"
}
}
}
}
Please provide the environment you discovered this bug in (run ng version)
Angular CLI : 21.2.14
Angular : 21.2.17
Node.js : 24.16.0
Package Manager : npm 11.10.0
Operating System : win32 x64
┌───────────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────────┼───────────────────┼───────────────────┤
│ @angular-devkit/build-angular │ 21.2.14 │ ^21.2.14 │
│ @angular/build │ 21.2.14 │ ^21.2.14 │
│ @angular/cli │ 21.2.14 │ 21.2.14 │
│ @angular/common │ 21.2.17 │ 21.2.17 │
│ @angular/compiler │ 21.2.17 │ 21.2.17 │
│ @angular/compiler-cli │ 21.2.17 │ 21.2.17 │
│ @angular/core │ 21.2.17 │ 21.2.17 │
│ @angular/forms │ 21.2.17 │ 21.2.17 │
│ @angular/language-service │ 21.2.17 │ 21.2.17 │
│ @angular/localize │ 21.2.17 │ ^21.2.17 │
│ @angular/platform-browser │ 21.2.17 │ 21.2.17 │
│ @angular/router │ 21.2.17 │ 21.2.17 │
│ @angular/service-worker │ 21.2.17 │ 21.2.17 │
│ rxjs │ 7.8.2 │ ^7.8.2 │
│ typescript │ 5.9.3 │ 5.9.3 │
│ zone.js │ 0.16.2 │ ~0.16.2 │
└───────────────────────────────┴───────────────────┴───────────────────┘
Anything else?
Because 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:
NG8002: Can't bind to 'auiTypedOption' since it isn't a known property of 'div'.
Activity
kle-pra commentedon Jun 12, 2026
I experience this problem as well, it would be great if this could be fixed.
JeanMeche commentedon Jun 12, 2026
I'm getting
Can't bind to 'auiTypedOption' since it isn't a known property of 'div'.ngtsc(-998002)with your example. $Please provide a repro.
sysmat commentedon Jun 13, 2026
@JeanMeche my bad of reproducing the bug. Also I get the same error
Here is better.
directive
[-]bug(compiler): strictTemplates fails to report unknown property binding when a standalone directive is missing from component imports[/-][+]Compiler doesn't report missing import for a directive applied on `ng-template`[/+]19 remaining items
fix(compiler): report unknown property bindings on explicit ng-templa…
fix(compiler): report unknown property bindings on explicit ng-templa…
fix(compiler): report unknown property bindings on explicit ng-templa…
fix(compiler): report unknown property bindings on explicit ng-templa…
fix(compiler): report unknown property bindings on explicit ng-templa…
fix(compiler): report unknown property bindings on explicit ng-templa…
fix(compiler): report unknown property bindings on explicit ng-templa…
feature(compiler): report unknown property bindings on explicit ng-te…
feat(compiler): report unknown property bindings on explicit ng-templ…
feat(compiler): report unknown property bindings on explicit ng-templ…
feat(compiler): report unknown property bindings on explicit ng-templ…
feat(compiler): report unknown property bindings on explicit ng-templ…
feat(compiler): report unknown property bindings on explicit ng-templ…
feat(compiler): report unknown property bindings on explicit ng-templ…