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

3

我正在使用Angular JS 1.4.1和Angular Toastr 1.7.0。

我的应用程序中大多数toastr都是默认的右上角,而且运行良好。

然而,我想使用positionClass: 'toast-top-full-width'来调用其中一个,但是我无法使其正常工作。它仍然在我的应用程序配置中设置的默认位置打开。

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

我在这里缺少什么?

2个回答

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

1

根据文档,似乎无法在toast中覆盖属性,但将在未来版本中更改:

常见问题解答

问:为什么我不能覆盖toast中的positionClass?它被忽略了。 答:toast没有位置,它们附加到一个容器上,并且该容器在页面上设置了位置。这将在未来版本中更改。


这很奇怪,因为Angular Toastr的文档似乎说可以这样做,这就是我为什么做了以下操作的原因:toastr.info('What a nice apple button', 'Button spree', { closeButton: true, closeHtml: '<button></button>' }); - Steve
当然,现在我看到了关于我正在尝试覆盖的“一件事”的警告。谢谢。 - Steve

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接