I used the angular2 material of MdDialog to show the shape.
When the user submits the form, the request is sent to the backend, and if the request is successful, I need to close the dialog. If the backend request failed, I need to leave the dialog open.
I can close the dialog using the button as shown below.
<button md-raised-button md-dialog-close>Cancel</button>
But in this case, I need to close the dialog only if the backend request is successful, so I need a way to programmatically close the dialog.
The component that appears inside the dialog box does not have a ref dialog, and I do not know of any other way to close the dialog box from the component myself.
Is there a way to close a dialog box inside a component inside a dialog box?
angular angular-material2
Lahiru chandima
source share