简体   繁体   English

AngularJS-Toaster如何杀死烤面包机

[英]AngularJS-Toaster how to kill a toaster

How to stop a AngularJS-Toaster before starting the other one like i want to stop the 如何在启动另一个像我想停止之前停止AngularJS-Toaster

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(); toaster.clear();

method to kill a toaster. 杀死烤面包机的方法。

I see in the source code of that directive that there is a method called removeToast. 我在该指令的源代码中看到有一个称为removeToast的方法。 You can pass a toast id and it will remove the toast. 您可以传递一个吐司ID,它将删除吐司。 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 资料来源:AngularJS-Toaster @ Github

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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