angular-2-local-storage
angular-2-local-storage copied to clipboard
Question: localstorage in a Angular2 Service
I am trying to get the local storage to persist some auth token info, and it is occurring in a service. Strangly enough it does not seem to want to persist. If I redirect to the auth middleware (IdentityServer3) and then redirect back to the original site, the data I persisted is not there anymore. Is there something special I need to do to get localstorage to work for a service?
Did you add the LocalStorageModule at the root of your application?
And did you set the storageType config option?
If you put a breakpoint in your code after it stores the auth token, before it redirects off somewhere else, can you see your value stored in localStorage correctly?