javascriptangularjstoastrangular-toastr

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?


Solution

  • 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.