This post will be about Dialog of Angular Material.
If you want to use dialog across different modules (for example, you call module login) you will see follow error:
Error: No provider for MatDialogRefor the same if you want to get data form parent module:
Error: No provider for MAT_DIALOG_DATAbecause this class is not @Injectable, and works only through MatDialog. Maybe there has some bug, connecte to InjectionToken...
So, you need insert MatDialog to your constructor of called component of other module:
constructor(public dialog: MatDialog) {}Then you can find your dialog by:
const ref:MatDialogRef<any> = this.dialog.openDialogs[0];
Good luck!
PS: maybe I missed something and MatDialogRef works fine with different the modules for somebody, please, tell me, I will be appreciated.