Comments (16)
I noticed this and will be looking into it. I didn't seem to have this problem when I used an object (which is how I usually use $localStorage). Ex:
$localStorage.awesome = { key: 'value' };
In which it seemed more consistent. Will look into it.
from ngstorage.
i have same issue regarding this local storage first i have x value when i go to previous page and get y value i am getting y value.but, i need to be displayed with x and y value
from ngstorage.
Same here
from ngstorage.
I have similar issue: $localStorage
contain my value, but localStorage
does not
from ngstorage.
Same: localStorage saves value a, at some point I update it to value b (this works), then when I refresh it goes back to value a
from ngstorage.
I'm having the same problem as emiidee, it does update to new value but it keeps giving the old value when I refresh, why is that?
from ngstorage.
@SlashingEdge could you try using master ngStorage.js and provide a snippets where this happen for me to test? :)
from ngstorage.
As the plnkr doesn't seem to work, anyone that can confirm this still is a issue?
from ngstorage.
Same here, updating $localStorage.token every 30 mins. The value remains the same.
from ngstorage.
I notice the behavior described above where updates stopped working if I have multiple $localStorage.$default({...});
calls with different defaults in different angular components.
For example, if ServiceA
has var $storageA = $localStorage.$default({ a: "foor"});
and ServiceB
has var $storageB = $localStorage.$default({ b: "bar"});
.
I got around this by making my own service wrapper with a var $storage = $localStorage.$default({ a: "foo", b: "bar"});
. Then the wrapper service had a method to getA()
and getB()
.
Note sure if this is a correct usage, but it got around the issue for me.
from ngstorage.
Thanks bdkent for the reports.
There should be no need to make extra services. And I'll continue working on it. But sadly my time has been limited these last weeks. But I'm still here and will have more time soon :)
from ngstorage.
I found that for me this was an issue with $localstorage.$default.
My workaround was to replace
x = $localstorage.$default({a: "foo"})
with
x.a = $localstorage.a || "foo";
This seems to restore the expected behaviour, having replaced $default everywhere in my code.
from ngstorage.
Thanks. Seems the whole of $default is a little screwed up.
from ngstorage.
+1
Current workaround: $localStorage.a = $localStorage.a || 'foo';
from ngstorage.
I've faced a similar issue and it happened because I was setting item using localStorage.setItem(key value)
and tried to read data using $localStorage.key
which, of course is not ok. I used localStorage.setItem
because of the need to immediately catch QuotaExceededError. The fix was to read data using localStorage.getItem
or call $localStorage.$sync()
to sync the ngStorage with native localStorage .
from ngstorage.
Same: localStorage saves value a, at some point I update it to value b (this works), then when I refresh it goes back to value a
you can call a method in respective service regarding to localStorage like getRole(),getToken()..it return localStorage.getItem('key')
so in your template(.html) ,you can call directly like authService.getToken() it returns updated value only.
Before that you can provide dependency injection in your component.
It works...
from ngstorage.
Related Issues (20)
- Uncaught SyntaxError: Unexpected token _ in JSON at position 0 HOT 2
- Does ngStorage Work for PhoneGapp?
- $sessionStorage get undefined after refreshing the page but $localStorage not HOT 1
- How to improve performance for large datasets
- $localStorageProvider.setKeyPrefix cause crash
- Support for angular 2
- ngStorage module not found error in production package HOT 1
- Can localstorage value persist across opened tabs/windows ? HOT 1
- Too many dependencies
- storage.$reset() doesn't work fine with parameter HOT 1
- storage.$reset() returning a promise
- ngStorage causes digests through entire application HOT 2
- Cannot minify correctly using minifier package
- delete $localStorage.storageName not working HOT 1
- There is phantomjs and karma in dependencies. Why? As ngStorage user i think it should be in devDeps. HOT 1
- BUG: On $reset if load the same values the Local Storage is clear. HOT 1
- Issue when changing document focus
- Fortify scan(Insecure Randomness)
- Dependency Vulnerabilities
- TypeError: a.key is null
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngstorage.