Scenario: I have an component called add-customer which i am displaying in an dialogue  window by clicking an button called Addas shown in below image.
Here i have 2 buttons 1)Save and 2)Cancel
On clicking Cancel button one more dialogue window comes as shown in below image.
Here in the new dialogue window again i have two buttons called 1)Discard and 2)Cancel
On clicking Cancel the new window will close and the add-customer component will remain same as shown in below image. 
Here my requirement are:
1) On clicking dicard button i want to close both the dialogue windows(mean i want to close two pop-up windows).
2) Here the add-customer component is closing when we are clicking outside the dialogue window,but i want it to be closed only on clicking discard button only.
I have tried by giving two different dialogRef for discard and cancel buttons. No result. Here is the stackblitz link.



 
    