[Fixed] Angular notifier not working after page refresh


I have built an angular application where I used angular-notifier (version 6.0.1) in order to display different kind of notifications to the user. When first starting the app, is working as expected, no matter how many notifications are displayed.

However, if I apply a page refresh / closing the browser and opening it again (so that the application is destroyed and re-created), the notifications will stop showing, even if the place where notify(..) is called is reached.

The problem started to appear after I implemented an APP_INITIALIZER, but the function executed at start has no business with the notification, and the first time is working.

Any sugestion for this problem? Thanks!


So after a while I found the issue, I will post an answer for those who encounter the same issue and are struggling to find a solution.

In APP_INITIALIZER function I had a case where the notifier was indeed called. Because was called in APP_INITIALIZER, I belive it was left in a state with no recover possible and it can no longer be used.

Remove the notifier call from APP_INITIALIZER, move the logic in other place and it will work as expected.

Leave a Reply

(*) Required, Your email will not be published