Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newestOnTop only works when edited on the global toastrConfig #881

Open
iampranavsethi opened this issue May 14, 2021 · 1 comment
Open

Comments

@iampranavsethi
Copy link

iampranavsethi commented May 14, 2021

Hi,

I saw issue #818 and is marked as fixed in v12.1.0 (162b64f)

But this seems to have only moved the option for newestOnTop to the IndividualConfig options.

The way that this works is if you edit the toastrService.toastrConfig.newestOnTop value.

In the demo application, the way it works is that you set the options from toastrConfig (reference object)

constructor(public toastr: ToastrService, private renderer: Renderer2) {
    this.options = this.toastr.toastrConfig;  // ngModel directly changing toastrConfig (options == toastr.toastrConfig)
  }
  ...
  openToast() {
    const opt = cloneDeep(this.options);    // cloning the already changed the this.toastr.toastrConfig through this.options

From my example, (since I did not want to change it in the forRoot({...}))

this.toastrService.show(message, title, { newestOnTop: false});   // did not work

// to make it work I had to do the following - 
this.toastrService.toastrConfig.newestOnTop = false;
this.toastrService.show(message, title);
this.toastrService.toastrConfig.newestOnTop = true;

My question is, is this the correct way of how it was intended to work? or is this an issue and can be added to the backlog?

If this is not, feel free to close this issue.

Thanks!

Angular v9.1.12
ngx-toastr version: 12.1.0

@Erbenos
Copy link

Erbenos commented Dec 2, 2021

Can reproduce as well.

Angular v12.2.0
ngx-toastr version: 14.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants