Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module storage {
- export class Storage {
- public static $inject = [
- '$window'
- ]
- constructor(private $window: angular.IWindowService) {
- }
- public get(key) {
- return JSON.parse(this.$window.localStorage.getItem(key));
- }
- public save(key, data) {
- this.$window.localStorage.setItem(key, JSON.stringify(data));
- }
- public remove(key) {
- this.$window.localStorage.removeItem(key);
- }
- public clearAll() {
- this.$window.localStorage.clear();
- }
- }
- }
- angular.module('storage').service('storage.Storage', storage.Storage);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement