angular2-mdl icon indicating copy to clipboard operation
angular2-mdl copied to clipboard

Programmatically close a snackbar.

Open dksheffield opened this issue 9 years ago • 2 comments

I can get a snackbar working but i'm not able to close it programmatically. My use case is to show a snackbar Loading... when my app reaches out to the server, then I want to close that snackbar when the server responds. I'm sure it is easy i'm just not sure the lifecycle of the snackbar observable. Thanks!!!

dksheffield avatar Dec 13 '16 03:12 dksheffield

this isn't a covered use case by the snackbar. either you have a timeout or an action. if you do not specify a timeout the default value will be used (2750 ms). you can call hide on the snackbar component - but this will only work if the user did not hit the action or the timeout isn't reached.

          this.mdlSnackbarService.showToast('You hit the ok Button').subscribe( (comp)  => {
            comp.hide();
          });

mseemann avatar Dec 13 '16 08:12 mseemann

Thanks, I will use something else to show loading.

dksheffield avatar Dec 13 '16 21:12 dksheffield