Angular/Ionic Singleton gets destroyed after refresh

i have a singleton typescript class that stores the Login Credentials of a user. I set them on the login Page and go to the next page with my Angular Router.navigate. (without params), on the next page i want to consume my singleton, and it works perfectly, but if Irefresh the page the singleton is undefined?
How can i solve this?

This is the error after refreshing:

  • core.js:5980 ERROR Error: Uncaught (in promise): TypeError: Cannot
    read property ‘socialSecurityNumber’ of undefined TypeError: Cannot
    read property ‘socialSecurityNumber’ of undefined

Thanks

24 thoughts on “Angular/Ionic Singleton gets destroyed after refresh”

Leave a Comment