简体   繁体   English

设置Angular Toastr的单个实例的选项?

[英]Set options for single instance of an Angular Toastr?

I am using Angular JS 1.4.1 and Angular Toastr 1.7.0. 我使用的是Angular JS 1.4.1和Angular Toastr 1.7.0。

Most of the toastrs in my app are the default top right, and work fine. 我的应用程序中的大多数toastrs是默认的右上角,并且工作正常。

However, I want to call ONE with the positionClass: 'toast-top-full-width' and I can't get it to work. 但是,我想用positionClass: 'toast-top-full-width'调用ONE positionClass: 'toast-top-full-width' ,我无法让它工作。 It still opens at the defaults set it my app config. 它仍然以我的app配置设置的默认值打开。

   $scope.tabLeave = function () {
    toastr.warning('Warning', 'You have unsaved data.', {
      closeButton: true,
      positionClass: 'toast-top-full-width'
    });
  };

What am missing here? 这里缺少什么?

Based on the documentation , it seems that property cannot be overridden in a toast, but will be changed in a future version: 根据文档 ,似乎无法在toast中覆盖属性,但将在以后的版本中进行更改:

FAQ 常问问题

Q: Why can't I override the positionClass in a toast? 问:为什么我不能在toast中覆盖positionClass? It gets ignored. 它被忽略了。 A: The toasts don't have a position, they are attached to a container and is that container who has the position set on the page. 答:祝酒词没有位置,它们附在容器上,是在页面上设置位置的容器。 This will be changed in a future version. 这将在未来版本中更改。

this.toastr.info('No credit remaining', '', { disableTimeOut: true, closeButton: true });

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

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