Open
Description
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
As of angular 14 we have the new super useful setInput
on ComponentRef
for dynamic components. It finally allows fully CD aware dynamic inputs changing.
Currently if I want to extend a component with a directive and set inputs from it I need to do one of the two options:
- Change the inputs statically in the constructor
- Change inputs to get/set as
ngOnChanges
won't fire
Proposed solution
Allowing to inject ComponentRef
of the host component instead of the actual instance. This way we could just use setInput
to update inputs and have a full CD aware binding support not through the template.
Alternatives considered
- Change the inputs statically in the constructor only - Can't apply to directive input based changes or observable based changes
- Change inputs to get/set - Possible but annoying and "leaks" the knowledge of this component is being used from a directive outside. How can one explain why
ngOnChanges
was not used... - Maybe not through
ComponentRef
but as any other way to usesetInput
from DI injected components
Metadata
Metadata
Assignees
Labels
Issues related to the framework runtimeIssues related to the framework runtimeIssue that requests a new featureIssue that requests a new featureFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationThis issue needs additional clarification from the reporter before the team can investigate.This issue needs additional clarification from the reporter before the team can investigate.