$localStorage

Description

Provides a key-value (string-object) storage, that is backed by localStorage with support for expiry (in days). Objects put or retrieved from this storage are automatically serialized or deserialized by angular's toJson/fromJson.

Dependencies

Usage

$localStorage($window, $location, $cacheFactory);

Parameters

ParamTypeDetails
$windowservice

The $window service.

$locationservice

The $location service.

$cacheFactoryservice

The $cacheFactory service.

Methods

Example

myApp.$inject = ['$localStorage'];
function myApp($localStorage) {
  // Your app
}

angular
  .module('myApp', ['swxLocalStorage']);