Local resource support for Angular using HTML5 storage
Combines the best of ngResource, ngStorage and angular-local-storage to give you access to local and session storage within Angular, but also provides a storage strategy that supports sharing sessionStorage data between multiple tabs via transientlocalStorage use.
A session service consists of an object that when stored will be identified via the prefixed key 'session':
angular .module('auth', ['yaacovCR.storedObject']); angular .module('auth') .factory('session', session); function session(ycr$StoredObject) { return new ycr$StoredObject('session'); }
An auth service manipulates the properties of the session object and calls $create and $delete as needed to persist to/delete from storage. $update, not shown, can be used when the token needs to be refreshed.