components icon indicating copy to clipboard operation
components copied to clipboard

feat(material/dialog): Allow @Input for data sharing

Open ferhado opened this issue 3 months ago • 2 comments

Feature Description

Currently, Angular Material's MatDialog and CDK's Dialog components use MAT_DIALOG_DATA for passing data. This feature proposes to allow the usage of @Input for data sharing instead.

Use Case

This feature allows for greater flexibility and reusability of dialog components, particularly when using the Router option withComponentInputBinding. For example:

// Proposed usage with @Input
@Component({
  selector: 'app-my-dialog',
  template: ``
})
export class MyDialogComponent {
  @Input() name: string;
  @Input() age: number;
}

// Open dialog
this.dialog.open(MyDialogComponent, {
  data: { name: 'John', age: 30 }
});

ferhado avatar Mar 28 '24 12:03 ferhado