angular-2-local-storage
angular-2-local-storage copied to clipboard
get() method doesn't return string values which are not enclosed in quotes (")
3rd party libraries may access localStorage through window object which saves strings (e.g. authentication tokens by angular2-jwt) without quotes, e.g. (abcd...)
- get() method parses stored values as JSON and requires all strings to be enclosed in quotes ("abcd...") and returns null otherwise.
as the result - there is no way to access saved data.
Please try this way.
let currentUser = JSON.parse(this.localStorageService.get('TOKEN').toString());