My situation is I want to open a dialog component, in which I pass a value from the main component, then after closing I just want to refresh the table in the main component, but without using any subscription or passing any value to the main component.
The code is like this:
openDialog(employeeId: string): void {
let dialogRef = this.dialog.open(ExampleDialogComponent, {
width: '250px',
data: employeeId,
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
this.dataSaved = true;
this.employeeIdUpdate = null;
this.employeeForm.reset();
this.loadAllEmployees();
});
}
Now the variable result
is coming as undefined
, but can I not use the subscribe at all? I just want the below statement and function to work after I close the dialog. Thank you