Open ferhado opened 3 months ago
How would this work in practice? The dialog isn't rendered in a template so the only way to set the input would be through setInput
.
Hi @crisbeto,
In theory, this approach works:
const dialogRef = this.dialog.open(MyDialogComponent);
dialogRef.componentInstance.name = 'John';
dialogRef.componentInstance.age = 30;
However, this method is tricky and not ideal for practical use. It would be better implemented directly within the CDK to ensure a more robust and streamlined solution for data binding via @Input
.
I'm not familiar with the source code, so I'm unsure how this would integrate with the new Angular feature signals for compatibility.
Thanks for considering this feature.
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: