Ngx-toastr: issues running ngx-toastr in Server Side Render

Created on 8 Sep 2018  ·  8Comments  ·  Source: scttcper/ngx-toastr

Hello, first of all, congratulations for your excellent work developing ngx-toastr.
The problem that I come to report is when I use the ngx-toastr module with Angularfire and Universal.
I made my application in Angular 6, I followed your instructions for installation and use. Everything works perfectly when I try the application with ng serve. In the same way, everything works well with the application when I run ng build --prod.
But my problem comes when I follow the steps to achieve the server side render with Angularfire and Universal.
I follow the steps described in:
https://github.com/angular/angularfire2/blob/dfaaac880d2829a893d471a2ee3811b79fcfaff3/docs/universal/getting-started.md
I get the application compile and run without errors BUT THE BEHAVIOR OF ngx-toastr RUNNING ON THE SERVER IS UNEXPECTED.
The first thing I saw is that the animations do not work in the same way as when I run the angular server with ng serve; but that is not important, that can be ignored; But WHAT I SEE AS ​​A PROBLEM IS THAT SOME TOAST DOES NOT DISMISS BYPASSING THE TIMEOUT, NEITHER DISMISS WITH TAP ON THE TOAST TO DISMISS.

I have prepared a repository so that you can verify what I say:
https://github.com/IngAjVillalon/Angular-Universal-6-Server-Side-Render
The steps you must follow are:
Clone this repository
npm install
npm run build && npm run serve: ssr

You can see what I mentioned earlier.

Could you please help me to make ngx-toastr run well on the server side?

Most helpful comment

Thanks for the repo and i'll try to take a deeper look at it soon to see if we can do anything. I would avoid drawing toasts during route changes or on application init. You might also try number 1 in the FAQ https://github.com/scttcper/ngx-toastr#faq

All 8 comments

Thanks for the repo and i'll try to take a deeper look at it soon to see if we can do anything. I would avoid drawing toasts during route changes or on application init. You might also try number 1 in the FAQ https://github.com/scttcper/ngx-toastr#faq

It happens exactly the same.
Please help us, @scttcper .

What happens if you set onActivateTick to true when displaying the toasts from the server?

Hi @yarrgh, thank you very much for your suggestion.
I did what you tell me, and NO, it still does not close the first toast that comes out on the server.
@yarrgh, you can be free to clone the repository and we will make a help sheet with the requirements that those who will upload their application to the server using toastr need.
All follow in touch.
Greetings.

Hi there, and happy new year. I have the same issue.

I believe that a config option that would make the toast ignored when running on the server would be awesome.

Would it be something that you could add easily?

ok time to fork I guess

Any solution?

Same problem!
Is there any solution?

Was this page helpful?
0 / 5 - 0 ratings