Skip to content

fix(compiler): report unknown property binding on ng-template when standalone directive is missing from imports#69555

Open
BHUVANSH855 wants to merge 1 commit into
angular:mainfrom
BHUVANSH855:fix-69322-ng-template-missing-import
Open

fix(compiler): report unknown property binding on ng-template when standalone directive is missing from imports#69555
BHUVANSH855 wants to merge 1 commit into
angular:mainfrom
BHUVANSH855:fix-69322-ng-template-missing-import

Conversation

@BHUVANSH855

@BHUVANSH855 BHUVANSH855 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

When a custom property binding matching a standalone directive's input selector is placed directly on an <ng-template> element (e.g., <ng-template [myDirectiveInput]="value">), the template type-checker fails to flag it as an unknown property if the directive is forgotten in the @Component.imports array.

This happens because the template type-checker's TcbDomSchemaCheckerOp iterates exclusively over element.inputs when evaluating template element node types, completely missing property bindings declared on structural elements, which are parsed by the compiler AST into element.templateAttrs.

Fixes #69322

What is the new behavior?

The TcbDomSchemaCheckerOp execution phase has been updated to filter and securely append BoundAttribute nodes from element.templateAttrs to the active bindings array when processing Template elements. This ensures that custom or unknown property bindings on <ng-template> structures correctly pass through the RegistryDomSchemaChecker validation layer and accurately emit diagnostic errors under strictTemplates rules when a corresponding directive is missing from component imports.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@pullapprove pullapprove Bot requested a review from atscott June 28, 2026 11:24
@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Jun 28, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jun 28, 2026
@hawkgs

hawkgs commented Jun 29, 2026

Copy link
Copy Markdown
Member

@BHUVANSH855, the tests are failing.

@BHUVANSH855 BHUVANSH855 force-pushed the fix-69322-ng-template-missing-import branch from d55058d to cc53884 Compare June 29, 2026 10:59
@BHUVANSH855

Copy link
Copy Markdown
Contributor Author

@BHUVANSH855, the tests are failing.

Done, have a look.

@JeanMeche

JeanMeche commented Jun 29, 2026

Copy link
Copy Markdown
Member

You can and should be running pnpm bazel test //packages/compiler-cli/test/ngtsc:ngtsc to ensure the tests of the failing target pass locally (instead of probably relying on your agent)

@BHUVANSH855 BHUVANSH855 force-pushed the fix-69322-ng-template-missing-import branch 2 times, most recently from d2f8820 to 01b00ce Compare June 29, 2026 14:37
…andalone directive is missing from imports

Aggregates filtered BoundAttribute nodes from templateAttrs alongside element inputs to ensure strictTemplates diagnostics flag unimported directives on structural tags.

Closes angular#69322
@BHUVANSH855 BHUVANSH855 force-pushed the fix-69322-ng-template-missing-import branch from 01b00ce to 04be628 Compare June 29, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: compiler Issues related to `ngc`, Angular's template compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compiler doesn't report missing import for a directive applied on ng-template

3 participants