Steve
Steve

Reputation: 14912

Set options for single instance of an Angular Toastr?

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?

Upvotes: 3

Views: 1932

Answers (2)

user11561087
user11561087

Reputation: 21

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

Upvotes: 2

Matt M
Matt M

Reputation: 3779

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.

Upvotes: 1

Related Questions