Press "Enter" to skip to content

Simple Angularjs IndexedDB Service (factory)

This is example of simple angularjs indexedDB service (factory) for use in offline apps development. I simply did not find any suitable factory for indexedDB and decided to create a simple service to do the job.
Here is the service is on github - https://github.com/Velkata/IndexedDB-Angularjs-Service  and will be updated from time to time with new methods.


Usage:

First in the Service init method define your object stores and then access them with the dbService methods like on the example bellow.

dbService.getByIndex('games', 'owner_idx', $rootScope.user.id).then(
    function (games) {
                //array of game objects returned
    },
    function (error) {
               console.log(error);
    }
);
Please note not all methods are properly tested and some bugs may appear so I will continue improving the code and update it accordingly here.
Also operators like "greater that" or "less than" are not present. I will include more methods with them in future if I get to there.