【问题标题】:Set options for single instance of an Angular Toastr?为 Angular Toastr 的单个实例设置选项?
【发布时间】:2016-06-07 19:38:21
【问题描述】:

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

我的应用程序中的大多数 toastrs 都是默认右上角的,并且工作正常。

但是,我想使用positionClass: 'toast-top-full-width' 呼叫 ONE,但无法正常工作。它仍然以默认设置打开,将其设置为我的应用配置。

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

这里缺少什么?

【问题讨论】:

    标签: javascript angularjs toastr angular-toastr


    【解决方案1】:
    this.toastr.info('No credit remaining', '', { disableTimeOut: true, closeButton: true });
    

    【讨论】:

      【解决方案2】:

      基于documentation,似乎属性不能在toast中被覆盖,但会在未来的版本中改变:

      常见问题

      问:为什么我不能覆盖 toast 中的 positionClass?它被忽略。 A:吐司没有位置,它们附在容器上 并且是在页面上设置了位置的容器。这会 在未来的版本中进行更改。

      【讨论】:

      • 这很奇怪,因为 Angular Toastr 的文档似乎说你可以,这就是我这样做的原因:toastr.info('What a nice apple button', 'Button spree', { closeButton: true, closeHtml: '<button></button>' });
      • 当然,现在我看到了关于我试图覆盖的一件事的警告。谢谢。
      猜你喜欢
      • 2023-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-21
      • 1970-01-01
      • 1970-01-01
      • 2018-02-10
      • 1970-01-01
      相关资源
      最近更新 更多