added support for localstorage

This commit is contained in:
Mario Colque 2014-04-01 18:22:07 -03:00
commit c08eda28ab
6 changed files with 96 additions and 38 deletions

22
js/services/storage.js Normal file
View file

@ -0,0 +1,22 @@
'use strict';
angular.module('copay.storage')
.factory('Storage', function($rootScope) {
return {
get: function(key) {
return JSON.parse(localStorage.getItem(key));
},
save: function(key, data) {
localStorage.setItem(key, JSON.stringify(data));
},
remove: function(key) {
localStorage.removeItem(key);
},
clearAll: function() {
localStorage.clear();
}
};
});