Skip to content

Instantly share code, notes, and snippets.

@maxca
Last active October 20, 2016 10:33
Show Gist options
  • Select an option

  • Save maxca/ef9e2042673e37fb74f061f3b00f0d52 to your computer and use it in GitHub Desktop.

Select an option

Save maxca/ef9e2042673e37fb74f061f3b00f0d52 to your computer and use it in GitHub Desktop.
/** service local storage */
(function() {
var serviceLocalStorage = angular.module('serviceLocalStorage', []);
serviceLocalStorage.service('localStorage', function() {
this.set = function(key, value) {
return localStorage.setItem(key, value);
};
this.get = function(key) {
return localStorage.getItem(key);
};
this.del = function(key) {
return localStorage.removeItem(key);
}
this.cls = function() {
return localStorage.clear();
}
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment