Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposed Components Communication Channels #49320

Closed
KamilPieronczyk opened this issue Mar 4, 2023 · 3 comments
Closed

Exposed Components Communication Channels #49320

KamilPieronczyk opened this issue Mar 4, 2023 · 3 comments
Labels
area: core Issues related to the framework runtime core: inputs / outputs
Milestone

Comments

@KamilPieronczyk
Copy link

KamilPieronczyk commented Mar 4, 2023

Which @angular/* package(s) are relevant/related to the feature request?

core

Description

Writing wrapper comopnents for 3rd party libraries is tedious because of neccessity to expose all inputs and outputs of 3rd party component to parent component. Each 3rd party component update requires to recheck all wrappers. My proposal is to create an API to expose all inputs and outputs in seperate arrays.
If someone has better API design please update.

Proposed solution

@Component({
  selector: 'app-wrapper',
  template: `<app-child [title]="title" [{propsInputs}] ({propsOutputs})></app-child>`,
  propsInputs: [...Inputs(ChildComponent)],
  propsOutputs: [...Outputs(ChildComponent)],
})
export class WrapperComponent {
  @ViewChild(ChildComponent, { static: true }) child: ChildComponent;
  @Input() title = 'Overridden title input';
  @PropsInputs() propsInputs;
  @PropsOutputs() propsOutputs;
}

@Component({
  selector: 'app-child',
  template: '<p>{{ title }} {{ description }}</p>',
})
export class ChildComponent {
  @Input() title = '';
  @Input() description = '';
}

Usage

<app-wrapper [description]="Exposed Description"></app-wrapper>

Alternatives considered

No idea

@jessicajaniuk jessicajaniuk added the area: core Issues related to the framework runtime label Mar 6, 2023
@ngbot ngbot bot added this to the needsTriage milestone Mar 6, 2023
@vneogi199
Copy link
Contributor

Quite similar to #14545. Though it's a must have for library developers.

@pkozlowski-opensource
Copy link
Member

Also related discussion in #41993

@alxhub
Copy link
Member

alxhub commented May 29, 2024

Closing as a duplicate of #14545.

@alxhub alxhub closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues related to the framework runtime core: inputs / outputs
Projects
None yet
Development

No branches or pull requests

5 participants