从控制器更改烤面包机类toaster.pop()

时间:2014-09-30 11:30:50

标签: css angularjs

我使用烤面包机做角度:

https://github.com/jirikavi/AngularJS-Toaster

这是我的指示:

<toaster-container toaster-options="{'time-out': 3000}"></toaster-container>

这里一切都很好,我想做的就是这个,现在它向我显示屏幕右上角的所有信息,这就是我想要的(这也是默认行为),我想做(对于一些特别的消息):

<toaster-container toaster-options="{'position-class': 'toast-top-full-width'}"></toaster-container>

现在我似乎无法找到任何从pop()方法更改位置类的选项:

https://github.com/jirikavi/AngularJS-Toaster/pull/40/files?short_path=04c6e90

我目前拥有的是简单的消息:

toaster.pop('success','Redirecting to paypal');

我需要这样的事情:

   toaster.pop('success','Redirecting to paypal',{'position-class':'toast-top-full-width'});

我该怎么办?

1 个答案:

答案 0 :(得分:3)

我经常在我的索引页面中发布烤面包机配置,因为我使用烤面包机在整个系统中发送通知,这是一个适合写入的地方,而不是重复配置。

<toaster-container toaster-options="{
  'closeButton': false,
  'debug': false,
  'positionClass': 'toast-top-right',
  'onclick': null,
  'showDuration': '200',
  'hideDuration': '1000',
  'timeOut': '5000',
  'extendedTimeOut': '1000',
  'showEasing': 'swing',
  'hideEasing': 'linear',
  'showMethod': 'fadeIn',
  'hideMethod': 'fadeOut'
}"></toaster-container>
不要忘记包含该文件 AngularJS-Toaster / toaster.css到你的索引参考

然后pop的签名如下:

(type, title, body, timeout, bodyOutputType, clickHandler)

因此您必须执行类似

的操作
toaster.pop('success','Redirecting to paypal',null,'5000','toast-top-full-width');