function (key, value, keep) {

            // Get storage type
            keep = (typeof keep === 'undefined' || typeof keep !== 'boolean') ? false : keep;
            var storageType = keep ? 'localStorage' : 'sessionStorage';

            // Convert undefined values to null
            if (angular.isUndefined(value)) {
                value = null;
            } else if (angular.isObject(value) || angular.isArray(value)) {
                value = angular.toJson(value);
            }

            // Set web storage
            webStorage = $window[storageType];

            // Add data to storage
            webStorage.setItem(key, value);

            return true;
        }
function (key, value, keep) {

            
            keep = (typeof keep === 'undefined' || typeof keep !== 'boolean') ? false : keep;
            var storageType = keep ? 'localStorage' : 'sessionStorage';

            
            if (angular.isUndefined(value)) {
                value = null;
            } else if (angular.isObject(value) || angular.isArray(value)) {
                value = angular.toJson(value);
            }

            
            webStorage = $window[storageType];

            
            webStorage.setItem(key, value);

            return true;
        }
function ( key , value , keep ) { // Get storage type keep = ( typeof keep === 'undefined' || typeof keep !== 'boolean' ) ? false : keep ; var storageType = keep ? 'localStorage' : 'sessionStorage' ; // Convert undefined values to null if ( angular . isUndefined ( value ) ) { value = null ; } else if ( angular . isObject ( value ) || angular . isArray ( value ) ) { value = angular . toJson ( value ) ; } // Set web storage webStorage = $window [ storageType ] ; // Add data to storage webStorage . setItem ( key , value ) ; return true ; }
/*
Add value to storage
- key: key to retrieve data
- value: value of data
- keep: *optional* boolean to keep value indefinitly (localStorage) or temporarily (sessionStorage)
/ * Add value to storage - key : key to retrieve data - value : value of data - keep : * optional * boolean to keep value indefinitly ( localStorage ) or temporarily ( sessionStorage )