Repository to use local storage or cookies if browser does not have local-storage
Here is a live sample of this module
This module requires you to use angular 1.2.13 or superior Also you need to add ngCookies to your app:
angular.module('MyApp', [ ... , 'ngCookies' ])
<script src="path/to/lib/angular/angular-cookies.min.js"></script>
Add "localStorage" to your app modules list:
angular.module('MyApp', [ ... , 'KeyValueStorage', 'ngCookies' ])
Add the file in your scripts list:
<script src="path/to/lib/key-value-storage/key-value-storage.js"></script>
Inject "LocalStorage" in your controller/service's dependencies:
myModule.service("MyService", function( ... , KeyValueStorage){
// Your code
}
Store values:
LocalStorage.put(key, value);
Read values:
LocalStorage.get(key);
Delete values:
LocalStorage.remove(key);