Skip to content

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

Open
@ferhado

Description

@ferhado

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 }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/dialogfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions