-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MdSnackBar does not close when MdDialog is closed #2190
Comments
All of the Material modules are intended to do be independent of each other. If we closed all of the toasts automatically when a dialog is closed, we'd make the dialog module dependent on the snack bar. You can achieve the same by subscribing to the dialog's close observable: this.dialogRef = this.dialog.open(SomeDialog);
this.dialogRef.afterClosed().subscribe(result => {
// close your snack bar
}); |
Here is a Plunker showing the issue: http://plnkr.co/edit/xrf3OSZec4J1w2MncFbY?p=preview The component shown in the dialog is the component creating the snackbar |
In the above example dismiss is called on the MdSnackBarRef instance in ngOnDestroy of the dialog component |
@crisbeto could you take a look at this one? |
…troyed Fixes the snack bar not being removed from the DOM when it's associated `viewContainerRef` gets destroyed. Fixes angular#2190.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Bug
What is the expected behavior?
MdSnackBar should be closed automatically when it's host MdDialog is destroyed or should be closable in ngOnDestroy.
What is the current behavior?
MdSnackBar remains open even after it's host MdDialog is destroyed. The SnackBar will be unresponsive with the buttons unclickable.
What are the steps to reproduce?
Plunker with the behavior: http://plnkr.co/edit/xrf3OSZec4J1w2MncFbY?p=preview
What is the use-case or motivation for changing an existing behavior?
Better user and developer experience
Which versions of Angular, Material, OS, browsers are affected?
Angular 2, Material 2
The text was updated successfully, but these errors were encountered: