GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(compiler): report unclaimed property bindings on ng-template by tso1158687 · Pull Request #70345 · angular/angular

Conversation

@tso1158687

@tso1158687 tso1158687 commented Aug 23, 2026

Copy link
Copy Markdown

PR Checklist

  • The commit message follows our guidelines: https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features) — N/A

PR Type

  • Bugfix

What is the current behavior?

Property bindings on a literal <ng-template> element that are not claimed by any directive are never checked against the DOM schema during template type checking. Forgetting to import the directive in

@Directive({selector: 'ng-template[auiTypedOption]'})
export class TypedOptionDirective { auiTypedOption = input.required<any>(); }

@Component({imports: [], template: `<ng-template [auiTypedOption]="searchResult()"></ng-template>`})
export class TestComponent {}

compiles silently and only fails at runtime with NG0303, while the same binding on a <div> is reported as NG8002 at build time.

Issue Number: #69322

What is the new behavior?

A literal <ng-template> (tagName === 'ng-template') is treated like a regular element for the purpose of unclaimed inputs in the type-check block, so the missing import is reported as NG8002: Can't bind to 'auiTypedOption' since it isn't a known property of 'ng-template'. Bindings claimed by a matching directive (e.g. [ngTemplateOutlet], [ngIf]) are not reported. Synthetic Template nodes generated for structural directive shorthand are not affected, since their bindings are already checked on the wrapped element.

The shared fixture in template_mapping_spec.ts now also claims [ngIf]/[ngForOf] (and defines showMessage()), because the <ng-template [ngIf]> / <ng-template ngFor [ngForOf]> source-mapping scenarios relied on those bindings never being checked.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Templates that previously compiled with an unclaimed binding on <ng-template> (and then failed at runtime) now get a build-time diagnostic, consistent with regular elements. Unclaimed output bindings on <ng-template> are intentionally left as-is since they are outside the scope of the issue.

Verified locally with //packages/compiler-cli/src/ngtsc/typecheck/test:test (the new test fails without the change), //packages/compiler-cli/test/ngtsc:ngtsc and //packages/language-service/test:test.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tso1158687
fix(compiler): report unclaimed property bindings on ng-template
aadba38
Property bindings on a literal <ng-template> element that were not
claimed by any directive were never checked against the DOM schema
during template type checking, so forgetting to import the directive
compiled silently and only failed at runtime with NG0303.

Treat a literal <ng-template> the same way as a regular element for the
purpose of unclaimed inputs, so a missing import is reported as NG8002
at build time. Synthetic template nodes generated for structural
directive shorthand are not affected, since their bindings are checked
on the wrapped element.
@pullapprove
pullapprove Bot requested a review from JoostK August 23, 2026 04:00
@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Aug 23, 2026
@ngbot ngbot Bot added this to the Backlog milestone Aug 23, 2026
@SkyZeroZx

SkyZeroZx commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

This is a duplicate of #69640

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JeanMeche JeanMeche closed this Aug 23, 2026
@angular-automatic-lock-bot

angular-automatic-lock-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Oct 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@JoostK JoostK Awaiting requested review from JoostK

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

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

Projects

None yet

Milestone

Backlog

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@tso1158687 @SkyZeroZx @JeanMeche
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.