Angular Material - Not closing Material snackbar

BrS picture BrS · Apr 3, 2018 · Viewed 8.8k times · Source

I am using Angular and Angular Material version 5.

Is there a way to keep the snackbar open?

For example, if an error happens, open a snackbar and set a duration or a timeout on that snackbar to be closed after 5 seconds. If another error happens, within those 5 seconds, how can I instead of closing this one, and opening another snackbar, to just increase duration of this one for few seconds?

Here is stackblitz url: https://stackblitz.com/edit/angular-j4ww8y

Answer

Manuel picture Manuel · Jan 10, 2020

This doesn't answer the original question but, if you want a snackbar with indefinite duration: snackbar.open("Message", "Action", {duration: undefined});