3

I am using Angular JS 1.4.1 and Angular Toastr 1.7.0.

Most of the toastrs in my app are the default top right, and work fine.

However, I want to call ONE with the positionClass: 'toast-top-full-width' and I can't get it to work. It still opens at the defaults set it my app config.

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

What am missing here?

Steve
  • 14,401
  • 35
  • 125
  • 230

2 Answers2

2
this.toastr.info('No credit remaining', '', { disableTimeOut: true, closeButton: true });
double-beep
  • 5,031
  • 17
  • 33
  • 41
1

Based on the documentation, it seems that property cannot be overridden in a toast, but will be changed in a future version:

FAQ

Q: Why can't I override the positionClass in a toast? 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.

Matt M
  • 3,699
  • 5
  • 48
  • 76
  • Which is odd, since the docs for Angular Toastr seem to say you can, which is why I did what I did: `toastr.info('What a nice apple button', 'Button spree', { closeButton: true, closeHtml: '' });` – Steve Jun 07 '16 at 19:51
  • Of course, now I see the caveat about the ONE thing I am trying to override. Thanks. – Steve Jun 07 '16 at 19:53