-
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
How to use the snackbar action? #1581
Comments
If you are using the When you create a snackbar using Example: http://plnkr.co/edit/ouCdqAkp5dc3veD802lT?p=preview If you are using the You could use the same concept as above, but you could also directly call to take any action from within the custom component you have opened. |
This seems like a dangerous example, since the observable fires on dismiss, not on actual click. It seems like there should be a way to differentiate between the button and, say, a swipe dismiss. (Without having to use a custom component, since the standard API offers a button) |
It seems to me that an onAction() observable is missing from the MdSnackBarRef component. This observable is specified in https://docs.google.com/document/d/1XuD-sfGjZRB-TVFMULmD_FOSsOVJACVRy3XRJsQyYeQ/preview (referenced from #115) but is not yet implemented. @josephperrott you cannot rely on afterDismissed() observable for this because this observable is called in other situations, at least when a first snackbar is automatically dismissed by a newer snackbar. |
@feloy @josephperrott @jelbourn @wulfsberg Here a link to a little screen recording of my current status and question. Thanks. |
@stefanaerts I'm not sure you are attaching your snackbar to the right parent component. |
Tracking the lack of Closing this issue since it's asking a question, not reporting a bug/feature |
@feloy I moved it to the top appcomponent but that was not the reason the snackbar had the box-sizing: inherit,that did not help. |
Here is how you do it. |
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:
What is the expected behavior?
What is the current behavior?
What are the steps to reproduce?
Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, browsers are affected?
Is there anything else we should know?
I wonder where i can find an example of how to use the snackbar. I see the snackbar on the screen,but i have no idea how i can bind an action to the action button on the snackbar.
All i found is this:
failedAttempt() {
let config = new MdSnackBarConfig(this.viewContainerRef);
this.snackBar.open('It didn't quite work!', 'Try Again', config);
So how do i bind the Try again in this example to call another method?
Thanks
The text was updated successfully, but these errors were encountered: