-
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
[snack-bar] onAction subject never completes #8181
Comments
* Completes the `onAction` observable when a snack bar is closed, no matter whether it was through an action. * Refactors a few snack bar unit tests to use spies instead of toggling booleans. Fixes angular#8181.
* Completes the `onAction` observable when a snack bar is closed, no matter whether it was through an action. * Refactors a few snack bar unit tests to use spies instead of toggling booleans. Fixes angular#8181.
* Completes the `onAction` observable when a snack bar is closed, no matter whether it was through an action. * Refactors a few snack bar unit tests to use spies instead of toggling booleans. Fixes #8181.
There appears to already be a method which fires an action once the snackbar is destroyed (afterDismissed), but right now there's nothing to replace the old onAction command |
|
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 current behavior?
Subscribing to
onAction()
will result in a subscription that never completes unless the action button is clicked.Expected behavior
onAction()
completes when the snackbar ref is destroyed, I suppose in_finishDismiss()
.Reproduction
https://stackblitz.com/edit/angular-material2-issue-l1ymh2?file=app/app.component.ts
Motivation
I wish to open a snack-bar that has a duration longer than the expected lifetime of the component opening it. When the action is clicked, I would like to navigate to a new route.
I am unable to unsubscribe from the subscription in
ngOnDestroy
since the snackbar action may be available after the component is destroyed.The text was updated successfully, but these errors were encountered: