Visitar URL original
Exposed Components Communication Channels · Issue #49320 · angular/angular · GitHub
The Wayback Machine - https://web.archive.org/web/20251102145342/https://github.com/angular/angular/issues/49320
Skip to content

Exposed Components Communication Channels #49320

@KamilPieronczyk

Description

@KamilPieronczyk

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions