hostDirectives deep input mapping works implicitly and not explicitly #55218
Labels
area: compiler
Issues related to `ngc`, Angular's template compiler
Milestone
Which @angular/* package(s) are the source of the bug?
compiler
Is this a regression?
No
Description
Docs says that You can nest hostDirectives and that:
When you apply hostDirectives to your component, the inputs and outputs from the host directives are not included in your component's API by default. You can explicitly include inputs and outputs in your component's API by expanding the entry in hostDirectives
.https://angular.dev/guide/directives/directive-composition-api#including-inputs-and-outputs
So I would expect this to work:
but actually I get error saying:
TS-992017: Directive Level2Directive does not have an input with a public name of background.
What more this actually works:
and exposes input of
Level2Directive
implicitlyWhat I expect is even deeply hosted directives should only allow for explicitly defined input and outputs, with ability to alias those inputs and outputs which is especially important when multiple directives are hosted with input names that overlap.
I also think that deeply realiasing should be possible as well:
and aliasing overlaping inputs form difrent hosted directives should be possible:
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/~/github.com/kbrilla/angular-host-directives-composition-deep-input-mapping
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
Also, error from browser is missleading:
Altenative
If this is by design end expected behaviour please add that to the docs.
The text was updated successfully, but these errors were encountered: