Created
December 29, 2014 12:29
-
-
Save melloc01/0f977e56c6e6da146b35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (angular) { | |
angular.module('app').service('StorageService', [function () { | |
var service = { | |
setItem : setItem, | |
getItem : getItem, | |
removeItem : removeItem | |
}; | |
return service; | |
function setItem (key, value) { | |
localStorage.setItem(key,JSON.stringify(value)); | |
} | |
function getItem (key) { | |
return JSON.parse(localStorage.getItem(key)); | |
} | |
function removeItem (key) { | |
localStorage.removeItem(key); | |
} | |
}]); | |
})(angular); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment