Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get value from local storage when the key is start with uppercase #42

Closed
ofirrifo opened this issue Apr 5, 2017 · 6 comments
Closed

Comments

@ofirrifo
Copy link

ofirrifo commented Apr 5, 2017

First thanks for this good library.

I have a case that the key in the local storage is start with uppercase.
in my case is "Authorization" with capital "A"
and when I use the retrieve("Authorization") it return null.
I debug and found that the library change the key to lowercase.
is there a way to use capital to get value?

thanks

@PillowPillow PillowPillow self-assigned this Apr 6, 2017
@PillowPillow
Copy link
Owner

Hi, the library formats de generated key by concatenating a prefix and the lowerized raw key. All accesses to the property use this step.
You shouldn't have any issue to access to your property through retrieve('Authorization') since the key used behind the scene will be ng2-webstorage|authorization.

Are you sure that the value's set when you're trying to access it.

@ofirrifo
Copy link
Author

ofirrifo commented Apr 7, 2017

Hi, the "Authorization" that exist in the local storage not created via ng2-webstorage.
my situation is that:
I have an application that I build that use the ng2-webstorage.
my app is running other other app as iframe.
the parent app created the "Authorization" key in the local storage and my app that use the ng2-webstorage try to retrieve data from the local storage.

Thanks

@PillowPillow
Copy link
Owner

OK! understood. Currently you can remove the prefix and the separator but the raw key will always be formatted.
I could add an other option that disable this formatting.
I don't really have the time right now but i'll try to add it soon.
If you have time, a pr would be appreciated. :)

@ofirrifo
Copy link
Author

ofirrifo commented Apr 7, 2017

Thanks for the fast response.
ok I will do it.
Thanks :)

PillowPillow added a commit that referenced this issue Apr 21, 2017
@PillowPillow
Copy link
Owner

Hi! The last version offer a new option 'caseSensitive' allowing to disable the key formatting.
You can now do what you want :).

@ofirrifo
Copy link
Author

Thanks it's​great news :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants