AngularJS IndexedDB Cheatset by soiqualang :v

angularjs_indexedDB

My git repo

https://github.com/soiqualang/angularjs_indexedDB

angularjs_indexedDB

This is my note to work with indexedDB

I used lib from here:

https://github.com/bramski/angular-indexedDB

AngularJS IndexedDB Cheatset

Declare App

Create Database

db.createObjectStore(storeName, options);

Declare a database

store.createIndex(indexName, keyPath, options);

Declare index for search able fields

Insert

Insert single record

Insert an array

Select all records

Get all key

Delete

Delete all

Delete a record

Count records

Search – Find

Search item where id=9

Build a query

  • $lt(value) – less than
  • $gt(value) – greater than
  • $lte(value) – less than or equal
  • $gte(value) – greater than or equal
  • $eq(value) – equal
  • $between(lower, upper, doNotIncludeLowerBound? true/false, doNotIncludeUpperBound true/false) – between two bounds
  • $desc(unique) – descending order
  • $asc(unique) – ascending order
  • $index(value) – name of index

Find all records with country = “Norway”

That’s all, hope it useful for you^^

(But I’m still finding a way to help search text like .. like "%blabla%" @@)


https://itnext.io/indexeddb-your-second-step-towards-progressive-web-apps-pwa-dcbcd6cc2076

https://github.com/bramski/angular-indexedDB

https://gist.github.com/inexorabletash/a279f03ab5610817c0540c83857e4295