Search code examples
angularjsangular-toastr

How can I clear previous toastr before showing the new one and set a timeout between them?


I am using Angular toastr and I am stuck at passing a delay between hiding the previous toastr and showing the next one. There should be only one toastr at a time. I am hiding and showing it, but there is no visual difference, and still the toast messages are the same, the user is not able to distinguish which was previous and wich is next toast. I am firing them with two functions. Any help would be appreciated.

This is my setup:

        autoDismiss: true,
        maxOpened: 2,
        newestOnTop: true,
        extendedTimeOut: 1000,
        tapToDismiss: false,
        timeOut: 5000

Solution

  • Set

    maxOpened: 1
    

    in toastrConfig. This will prevent toasts from stacking and the second one will show up as soon as the first one expires.