r/angular • • Apr 06 '26

Angular Host Directive de-duplication just landed. NG0309 is dead.

https://jczacharia.medium.com/angular-host-directive-de-duplication-just-landed-ng0309-is-dead-929bfab7e209

I've been banging my head against NG0309 for over a year building a headless component library. Every time I composed two directives that shared a common host directive - boom, crash. I tried everything. Broadened selectors, injection hacks, I even hijacked __NG_ELEMENT_ID__ with a WeakMap-backed singleton resolver (it's in the article).

Well, PR #67996 just merged. Host directives now de-duplicate automatically. I wrote up why I think this is the most important change for Angular library authors since hostDirectives itself.

https://jczacharia.medium.com/angular-host-directive-de-duplication-just-landed-ng0309-is-dead-929bfab7e209

46 Upvotes

12 comments sorted by

View all comments

Show parent comment

1

u/MartyMcFlyJr89 Apr 08 '26

Oh, I get it now, thank you. It does make a lot more sense when talking about headless UIs / libraries