Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ralyodio/angular-html5-storage
HTML5 web storage for Angular.js
https://github.com/ralyodio/angular-html5-storage
Last synced: 2 months ago
JSON representation
HTML5 web storage for Angular.js
- Host: GitHub
- URL: https://github.com/ralyodio/angular-html5-storage
- Owner: ralyodio
- License: mit
- Created: 2014-10-20T04:14:42.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-07-24T09:16:38.000Z (over 9 years ago)
- Last Synced: 2024-10-09T20:42:27.947Z (3 months ago)
- Language: JavaScript
- Size: 352 KB
- Stars: 5
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# angular-html5-storage
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/chovy/angular-html5-storage?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)HTML5 web storage for Angular.js (ngHTML5Storage)
## Install
bower install angular-html5-storage --save
## Usage
create your service wrapper (optional)
app
.factory('myStorageService', ['ngHTML5Storage', function(ngHTML5Storage){
return {
saveStuffInLocalStorage: function(key, value){
return ngHTML5Storage.local(key, value);
},
saveStuffInSessionStorage: function(key, value){
return ngHTML5Storage.session(key, value);
}
};
}]);//in your controller (be sure to inject your service)
myStorageService.saveStuffInLocalStorage(key, value)
.then(function(data){
//it is saved in local storage
});
using ngHTML5Storage directly (without a service wrapper)
app
.controller('MyController', ['ngHTML5Storage', function(ngHTML5Storage){
ngHTML5Storage.session(key, value)
.then(function(data){
//it is saved in session storage
});
});## Methods of ngHTML5Storage
* `.local(key, value)` - set a value by key in localStorage
* `.session(key, value)` - set a value by key in sessionStorage
* `.local(key)` - get a value by key in localStorage
* `.session(key)` - get a value by key in sessionStoragedd
* `.remove.local(key)` - remove by key from localStorage
* `.remove.session(key)` - remove by key from sessionStorage## Run tests
gulp test
MIT License
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/chovy/angular-html5-storage/trend.png)](https://bitdeli.com/free "Bitdeli Badge")