UNPKG

todomvc

Version:

> Helping you select an MV\* framework

20 lines (16 loc) 393 B
/*global todomvc */ 'use strict'; /** * Services that persists and retrieves TODOs from localStorage */ todomvc.factory('todoStorage', function () { var STORAGE_ID = 'todos-angularjs-perf'; return { get: function () { return JSON.parse(localStorage.getItem(STORAGE_ID) || '[]'); }, put: function (todos) { localStorage.setItem(STORAGE_ID, JSON.stringify(todos)); } }; });