I am wondering if there is a way to call a method in one component from a dialog component?
Here is it, having the first component to be:
componentA
openDialog(): void {
const dialogRef = this.dialog.open(componentB.dialog, {
width: '700px',
});
methodToBeCalledFromCompB() { //how to called this
console.log('test');
}
The second component is
componentB.dialog
constructor(...) {}
public cancel() {
//how do I call the method methodToBeCalledFromCompB() that is in **copmponetA** here before closing the dialog
this.dialogRef.close();
}
How can I call methodToBeCalledFromCompB() when the cancle() is called in componentB.dialog?