So normally I would use cookies
to parse data from one AngularJS
application to another, and then read those cookies before bootstrapping
my application.
The problem with this approach is that the cookies have a size limit. And to get around this I thought about using $localstorage
from the ngStorage
library.
Now my problem is, how do I read the data stored in my $localstorage
before bootstrapping
my application, ie: in pure JavaScript
?
It is really simple:
Store item:
localStorage.setItem('key', 'value');
Get Item:
localStorage.getItem('key');
You may want to store JSON in the storage, so you can always use JSON.stringify(var) in your set method, and JSON.parse(var) after your get.