Is there a way to invoke a method in one component from a dialog component?
Let's take a look at the first component:
componentA
openDialog(): void {
const dialogRef = this.dialog.open(componentB.dialog, {
width: '700px',
});
methodToBeCalledFromCompB() { //how can I call this?
console.log('test');
}
The second component is
componentB.dialog
constructor(...) {}
public cancel() {
//how do I call the method methodToBeCalledFromCompB() that belongs to **componentA** here before closing the dialog
this.dialogRef.close();
}
How do I trigger methodToBeCalledFromCompB() when cancel() is called in componentB.dialog?