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

ngx-toastr not displaying until I refresh the page #1009

Open
Ahmid opened this issue Dec 1, 2023 · 4 comments
Open

ngx-toastr not displaying until I refresh the page #1009

Ahmid opened this issue Dec 1, 2023 · 4 comments

Comments

@Ahmid
Copy link

Ahmid commented Dec 1, 2023

I am using ngx-toastr in my application and after each deployment, the toastr messages doesn't show until I refresh the page and try again, only after I refresh it starts working normally without issues.

  1. We are using Google Chrome
  2. The Toastr container is being created, but the toast message itself is not being displayed
  3. We are not using CDN.
  4. No conflict with bootstrap css
  5. CSS is added properly into style.css (@import '~ngx-toastr/toastr.css';)

toaster-notworking

@Ahmid
Copy link
Author

Ahmid commented Dec 13, 2023

My investigation is leading to the following:
image

This line is evaluating to true even if the DIV is not created in the DOM

@geezz07
Copy link

geezz07 commented Apr 23, 2024

Hi any update on this? I am also experience a similar issues. On the initial page the toast does not appear until I navigate to another page and then all the toast works.

This is what I see when debugging. The toast object is added to the array however nothing is displayed on screen.

image

@Ahmid
Copy link
Author

Ahmid commented Apr 23, 2024

@geezz07 I solved it by automatically adding the div on each run.

Step.1: Import ToastContainerModule
image

Step.2: Inject the container:
image

Step.3: Add the HTML:
image

@geezz07
Copy link

geezz07 commented Apr 23, 2024

Thanks!

What I found in my case was that my page was very long and requires scrolling. The toast actually did display but it was at the bottom of the page, I had to scroll to the bottom of the page to see the toast. After looking at #955 I was able to resolve it by adding

.toast-container {
  position: fixed;
}

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