angular-local-storage
angular-local-storage copied to clipboard
What will happen if we set angularLocalStorage.setPrefix to empty
I'm currently getting an error in my IONIC app IOS platform, i.e. After 4,5 hours of closing my app, if I open my app, its localStorage gets empty, and all the data is removed, but if I force quit my app and reopen it, it gets all of its lost data back. I need to know whether what is the exact use of setPrefix, I cannot understand if that is causing this issue.
I have not run a manual test on setting the prefix to empty since early iterations of the codebase, but what will happen is that your keys will be stored in local storage as you set them.
That is to say localStorageService.set('mykey', 12345);
will store in local storage with the key "mykey".
The first thing I would check is to make sure you are not acidently calling any of the following: localStorageService.clearAll();
localStorageService.set('mykey', '');
localStorageService.remove('mykey');
Without using the prefix you also run the risk of collision with other apps on your domain using local storage.
I haven't used .clearAll() and also I'm not setting any property to ' ' (empty string)... I'm using .remove() but in very right places, and this issue is also different, because if the values are gone (deleted) then how all these values are again restored... :(
Are you binding directly to local storage?
No, I'm using a angularLocalStorage library for it. But that also binds directly...