What is the difference between ngStorage and $window.localStorage? When is it better to use one instead that the other? I have to choose one of them for a web app. I have to save data of profile user and the token
Just be mindful ngStorage internally uses an Angular watch to monitor changes to the $storage
/$localStorage
objects i.e a digest cycle is required to persist your new values reliably into the browser's local storage. Normally not a problem but if you store a value in $localStorage
and open a new tab without a digest cycle occurring, you might not be able to see the stored values in your newly opened tab/window.
Ran into this problem on IE and had to use window.localStorage
to get around it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With