Skip to content

fix: linker compiles hostBindings/hostVars for directives and emits signals flag#83

Merged
Brooooooklyn merged 1 commit intomainfrom
fix/linker-directive-host-bindings-and-signals
Mar 5, 2026
Merged

fix: linker compiles hostBindings/hostVars for directives and emits signals flag#83
Brooooooklyn merged 1 commit intomainfrom
fix/linker-directive-host-bindings-and-signals

Conversation

@Brooooooklyn
Copy link
Member

@Brooooooklyn Brooooooklyn commented Mar 5, 2026

The linker's link_directive was only generating hostAttrs for static
host attributes, but was missing compilation of dynamic host bindings
(hostVars and hostBindings). This caused directives like RouterLink
to lose their host property bindings (href, target) and event listeners
(click) at runtime, making them non-functional.

Also adds signals: true emission for both directives and components
when the partial declaration has isSignal: true, aligning with the
Angular TS compiler's baseDirectiveFields output.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com


Note

Medium Risk
Changes affect generated Angular runtime definitions (directive/component output), so regressions could break directive host bindings or compilation output even though coverage was expanded with new tests.

Overview
The linker now compiles directive host metadata into dynamic hostVars/hostBindings (in addition to hostAttrs), matching component behavior so directive host property bindings and event listeners are preserved at runtime.

It also emits signals: true in ɵɵdefineDirective/ɵɵdefineComponent when the partial declaration has isSignal: true, and adds focused regression tests around directive host bindings/listeners/attrs and signals. Minor refactors simplify pattern matching/formatting while keeping output semantics consistent.

Written by Cursor Bugbot for commit 3d8986f. This will update automatically on new commits. Configure here.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

…ignals flag

The linker's `link_directive` was only generating `hostAttrs` for static
host attributes, but was missing compilation of dynamic host bindings
(`hostVars` and `hostBindings`). This caused directives like RouterLink
to lose their host property bindings (href, target) and event listeners
(click) at runtime, making them non-functional.

Also adds `signals: true` emission for both directives and components
when the partial declaration has `isSignal: true`, aligning with the
Angular TS compiler's `baseDirectiveFields` output.

- Close #72

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Brooooooklyn Brooooooklyn force-pushed the fix/linker-directive-host-bindings-and-signals branch from ee29ae7 to 3d8986f Compare March 5, 2026 15:27
@Brooooooklyn Brooooooklyn merged commit 36fae07 into main Mar 5, 2026
4 checks passed
@Brooooooklyn Brooooooklyn deleted the fix/linker-directive-host-bindings-and-signals branch March 5, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RouterLink/directives are not applied at runtime

1 participant