简体   繁体   中英

AngularJS-Toaster how to kill a toaster

How to stop a AngularJS-Toaster before starting the other one like i want to stop the

toaster.pop('wait', "Email verification", 'Email is Sending');

and want to show the new toaster for success like

toaster.pop('success', "Email verification", "Your mail has been sent successfully. Please check your email id for the verification link.");

can anyone one tell me how to kill a toaster????

Hi i found its so simple just use

toaster.clear();

method to kill a toaster.

I see in the source code of that directive that there is a method called removeToast. You can pass a toast id and it will remove the toast. Did you try that one?

scope.removeToast = function (id) {
      var i, len, toast;
      for (i = 0, len = scope.toasters.length; i < len; i++) {
          if (scope.toasters[i].id === id) {
              removeToast(i);
              break;
          }
      }
  };

Source: AngularJS-Toaster @ Github

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM