-
Notifications
You must be signed in to change notification settings - Fork 27.1k
HostDirectives doesnt provide the hosted directives when inherited #51203
Copy link
Copy link
Closed
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: host directivesstate: has PR
Milestone
Description
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
Hi,
I have encountered an issue where hostDirectives doesn't provide with inheritance:
-
Create
BaseComponentthat uses theCustomDirectiveviahostDirectives:

-
Inject the
CustomDirectivein BaseClass viainject()method:

-
Create
ExtendsComponentthat extends via inheritence theBaseComponent:

If you try to run the application, it complains about missing provision for said directive:

If manually provides the CustomDirective inside the ExtendsComponent it works:

Please provide a link to a minimal reproduction of the bug
https://stackblitz-starters-icp5kn.stackblitz.io
Please provide the exception or error you saw
ERROR NullInjectorError: R3InjectorError(Standalone[App])[CustomDirective -> CustomDirective -> CustomDirective]:
NullInjectorError: No provider for CustomDirective!
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 16.1.4
Node: 18.16.1
Package Manager: npm 6.14.17
OS: win32 x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1601.4
@angular-devkit/core 16.1.4
@angular-devkit/schematics 16.1.4
@schematics/angular 16.1.4
Anything else?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: host directivesstate: has PR
