I have a following dialog component (which I open using dialog.open(MyDialogComponent)
in another component):
export class MyDialogComponent implements OnInit {
constructor(public matDialogRef: MatDialogRef<MyDialogComponent>) {}
ngOnInit() {}
}
I know I can return any data to the calling component by executing matDialogRef.close(dataToReturn)
bound to a button in dialog component. But how can I return the data if a user clicked elsewhere but the popup to close it?