angular-local-db

An AngularJS module that provides a simple key-value browser based database API.

Usage no npm install needed!

<script type="module">
  import angularLocalDb from 'https://cdn.skypack.dev/angular-local-db';
</script>

README

angular-local-db

An AngularJS module that that provides a simple key-value browser based database API. This module utilizes the browers local storage to provide for each caching and robust offline access to stored data.

Features

  • init
  • get
  • set
  • clear
  • getIndex
  • setIndex
  • clearIndex
  • addToSet
  • clearFromSet
  • addToIndexList
  • clearFromIndexList
  • addToIndexSet
  • clearFromIndexSet
  • getSecondaryIndex
  • setSecondaryIndex
  • clearSecondaryIndex
  • addToSecondaryIndexList
  • clearFromSecondaryIndexList
  • addToSecondaryIndexSet
  • clearFromSecondaryIndexSet

Install

Bower

bower install angular-local-db --save

NPM

npm install angular-local-db --save

Usage

Require angular-local-db

angular.module('app', [
    'angular-local-db'
]).controller('Ctrl', function(
    $scope,
    $localDb
){});

Methods

init(options)

Initializes the localDb instance namespace. This is useful to allow for caching of many users data on the same browser.

$localDb.init({namespace: User.id})

get(key)

Gets the stored value for the assigned key.

let myValue = $localDb.get(myKey)

Todos

  • ngdoc Documentation
  • Unit Tests
  • Gulp Tasks

Any contribution will be appreciated.