Skip to content

Repository to use local storage or cookies if browser does not have local-storage

Notifications You must be signed in to change notification settings

cyberdelphos/angular-key-value-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Angular Key Value Storage

Repository to use local storage or cookies if browser does not have local-storage

GitHub page

Sample

Here is a live sample of this module

Requirements

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>

Installation

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>

How to Use

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);

About

Repository to use local storage or cookies if browser does not have local-storage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published