Angular Material – Not closing Material snackbar

angularangular-materialsnackbar

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

Best Answer

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