Repository navigation
Description
I'm submitting a ... (check one with "x")
[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Currently each Input or Output must be explicitly declared in the component to allow its usage.
Expected behavior
I'd like to have any way to pass Inputs/Outputs to a component in the template without declaring them first. This is allowed in React with props spread and allows techniques like Higher Order Components.
<my-component [prop1]="prop1" {...otherInputs} ></my-component>What is the motivation / use case for changing the behavior?
Declaring each Input/Output is a problem when wrapping some component to extend its behaviour or to hide the component when dealing with an external library. It requires mapping each of the wrapped component Inputs/Outputs and it's very tedious and error prone. Besides any change in the wrapped component API would require touching the wrapper component.
Activity
lacolaco commentedon Feb 17, 2017
related to #11850
DzmitryShylovich commentedon Feb 17, 2017
Don't think they are related. This is a much more complex feature.
jiayihu commentedon Feb 17, 2017
@laco0416 yup not much related. That issue asks for
array spreadin function calls, whereas this feature is moreobject spreadof Inputs/Outputs.otodockal commentedon Feb 20, 2017
@fabiobiondi @manuel-di-iorio sorry guys, but don't spam the thread with "+1", use reactions instead.
fabiobiondi commentedon Feb 20, 2017
Sorry otodockal I was on mobile phone and it didn't support reactions. Now fixed. Thanx
crysislinux commentedon Dec 22, 2017
any updates on this? It's really verbose when you want to wrap some components. for example, if you want to use mat-select from @angular/material but apply some additional styles on it to make it another component(logically). It's not ideal to add a directive on it because:
Higher Order Components solves this problem quite well. I cannot figure out another way to do the same thing without write all the Input on the wrapper again. When dealing with Output, it's even verbose because you have to introduce EventEmitter for each Output again.
YogliB commentedon Aug 12, 2020
any chance we'll see this anytime?
pacocom commentedon Nov 20, 2020
I like spead props! In React is possible!!
Please add this to Angular.
LinboLen commentedon Dec 23, 2020
like this?
or maybe
mlc-mlapis commentedon Dec 23, 2020
@shybaLen What such a syntax means concretely on the
<my-component>side? And whatotherInputsandotherOutputsmeans on the host side?6 remaining items
b-barry commentedon Apr 12, 2023
Hello all,
Do we have a workaround at the moment?
xc404 commentedon May 25, 2023
I'm waiting for this feature
tombohub commentedon Jul 16, 2023
I believe this feature made react what is today. Because it's so easy to extend and build upon something. Just compare number of component libraries in react compared to other frameworks. We people are lazy, don't wanna type every single input to extend a component. This feature is of strategic importance for the benefit of angular ecosystem.
otodockal commentedon Jul 16, 2023
There is also a new library called Zag, which takes a novel approach to building UI components using FSMs(Finite State Machines) and heavily leverages spreads.
It would be a great addition to the Angular ecosystem if spreads is supported.
https://zagjs.com/
tombohub commentedon Jul 17, 2023
@otodockal how come there is no svelte version of zagjs? does svelte makes it hard to implement?
otodockal commentedon Jul 17, 2023
@tombohub They gave it a try, but it was removed for some reason chakra-ui/zag@bdb1950
There seems to be a problem with the lack of support for Events. sveltejs/svelte#5112
victor-assis commentedon Oct 8, 2023
Given this new feature, I was thinking, what if Angular had abstract directives that implement interfaces for native elements?
for example:
I created a complete example using a directive I created a while ago, which binds attributes:
https://stackblitz.com/edit/angular-ivy-mvhptb?file=src%2Fapp%2Fapp.component.html,src%2Fapp%2Fcomponents%2Fcheckbox%2Fcheckbox.component.ts
MGREMY commentedon Jan 25, 2024
Any update on this ? :)
robinsjovoll commentedon Mar 7, 2024
Also wondering about this - any updates? It would really help when creating wrapper components around third party components for instance. So that when the third party updates their components we doesn't have to explicitly add or change the params in our wrapper to support them.
ConteClaudioSalvatore commentedon Apr 2, 2024
hi, i was also wondering if this feature is still unplanned...
iwnow commentedon May 9, 2024
need it
xc404 commentedon Feb 2, 2025
any update on this feature
szacskesz commentedon Jul 13, 2025
I believe this would be really nice to have. For now there is no proper way (or I am not aware of it) to do wrapper component in Angular.
My use case
Create an
app-input-fieldwith a lot of inputs and outputs, and make it look like as the application needs it. Create a specialisedapp-password-fieldwhich is the same as the input field, but its sets type=password and doesnt let the developer change it (not exposed as an input)Sound reasonable and should be easy right? As far as I know this is not possible without any flaw:
Wrapper component manually forwarding inputs/outputs.
Using composition with ng-content (
<app- wrapper> <app-wrapped ... /> </app-wrapper>)Using directive on the component (
<app-wrapped appWrapper />)New component extending original
+1 Extending component and using hostDirectives
gund commentedon Apr 24, 2026
Its 2026, you could already vibe code this feature by now, for real what takes so long...
PatrickLarocque commentedon Jul 22, 2026
Design exploration: runtime binding sets
This is related to #14545 and #41993, but proposes a narrower primitive than automatic wrapper forwarding.
Angular can dynamically compose binding values, but not binding structure. Binding names must be statically present in the template so the compiler can classify them as directive inputs/outputs, DOM properties or attributes, styling, or events.
Passing an object input does not solve this: the receiving component must know its schema and manually reproduce Angular's renderer, sanitization, styling, and listener behavior.
Runtime classification is not unusual across frameworks: Vue's
v-bind, React and Solid DOM spreads, and Svelte element spreads classify or patch object keys at runtime, although their component and directive resolution models are simpler than Angular's.Proposed API
The same mechanism applies to Angular components:
The prototype currently resolves keys as follows:
value,disabledattr.*aria-*,data-*class,style(event)Explicit template bindings always win over the binding set, regardless of source order. Removed keys remove their previous property, attribute, styling, listener, or output-subscription contribution.
Prototype
I built a vertical prototype against Angular 22.1-next.6 covering:
Conceptually, this:
compiles to:
The compiler records statically explicit targets as exclusions, so the runtime set cannot overwrite them.
For an opted-in node, Angular identity-checks the binding-set object. When it changes, the runtime diffs its own keys and routes them through existing Angular input, renderer, styling, sanitizer, and listener paths. Templates without binding sets retain their current generated code and runtime path.
This is not an implicit
HostBinding: the binding source belongs to the parent template and is resolved alongside ordinary template bindings. It does not allow a directive to mutate peer inputs after input checking.Considerations
{...bindings()}accept a plain object, Angular's existingBindingdescriptors, or both?attr.*,class.*, andstyle.*[.unit]—or keep styling composition limited toclassandstylemap values?I know this is a bit much for a random comment from someone not on the core team. Just wanted to put this idea out there. If anyone cares, I can open a draft PR for eyes on the actual code shape.