Skip to content
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

Bug: Snackbar missing public action method for custom snackbars #5657

Closed
mtpultz opened this issue Jul 10, 2017 · 5 comments · Fixed by #5686
Closed

Bug: Snackbar missing public action method for custom snackbars #5657

mtpultz opened this issue Jul 10, 2017 · 5 comments · Fixed by #5686
Labels
help wanted The team would appreciate a PR from the community to address this issue P4 A relatively minor issue that is not relevant to core functions

Comments

@mtpultz
Copy link

mtpultz commented Jul 10, 2017

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Be able to close a custom snackbar using a public method to indicate action was used, and allow for use of onAction observable

What is the current behavior?

When you create a custom snackbar using openFromComponent you can pass in a snackBarRef and invoke any methods on self, but there is no public version of _action() so if you create a component and a user clicks your action you have to use a private method to be able to distinguish an action/dismiss or just a dismiss

What are the steps to reproduce?

N/A missing API call

What is the use-case or motivation for changing an existing behavior?

Snackbar's have two ways they can be closed, but right now in order to use the onAction observable you need to invoke a private method _action()

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 4.2.5, Angular Materila 2.0.0-beta.8, Windows 10

@willshowell
Copy link
Contributor

Looks like this was done intentionally #1826 (comment), but your use case absolutely makes sense.

@jelbourn?

@jelbourn
Copy link
Member

Good point. I would change the method name to closeWithAction if we make it public.

@jelbourn jelbourn added P4 A relatively minor issue that is not relevant to core functions help wanted The team would appreciate a PR from the community to address this issue labels Jul 10, 2017
@mtpultz
Copy link
Author

mtpultz commented Jul 11, 2017

@willshowell @jelbourn is there any reason not to send a value back through to onAction using closeWithAction(data). I noticed the new API for snackbars in master now has injectable data (https://github.com/angular/material2/blob/master/src/lib/snack-bar/snack-bar.md#sharing-data-with-a-custom-snack-bar) that reflects dialogs, but doesn't have a way to provide response data like a dialog does using close(data).

@jelbourn
Copy link
Member

Snackbars are meant to provide a notification with exactly one optional action. Adding the option for getting data from a snackbar would go against the intended use of the component per Material Design spec.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted The team would appreciate a PR from the community to address this issue P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants