I took a look at your stackblitz sample and made some modifications.
First, change this.dialogRef.close(row)
to this.dialogRef.close(row.name)
.
alter-dialog.component.ts
this.dialogRef.close(row.name);
Next, update the following in app.component.ts
.
app.component.ts
export class AppComponent {
version = VERSION;
value = ''; // Include this line.
constructor(private dialog: MatDialog, private snackBar: MatSnackBar) {}
openAlertDialog() {
const dialogRef = this.dialog.open(AlertDialogComponent, {});
dialogRef.afterClosed().subscribe((result) => { //
this.value = result; // Add these lines.
}); //
}
}
Then, insert [(ngModel)]="value"
into the
<input type="text">
field.
app.component.html
<input type="text" [(ngModel)]="value" />