Angular Dexie Bind
** A special thanks to angular-sails-bind for giving me this idea and as a starting point for this module **
This module provides an Angular JS service that allows you to bind a Dexie.js query to an angular variable. This is accomplished (and maintained) in one line
$dexieBind.bind(db, db.TableName.where('key').equals('some_val'), $scope);
bind command performs the folling functions:
- Returns a $q promise that will resolve once the query is complete
- Watches for any changes in your Dexie.js flavored IndexDB database using Dexie Observable
- Filters the results returned from the Dexie.js db so that it follows the parameters provided by your query
- Allows you to join other tables to this query by calling
$joinon the set returned from the promise
- If the distinct option was used in Dexie, instead of an
Arraybeing returned, the result is an
Objectwith the primary key of the table as the key for each record in the object.
- If the scope is destroyed, the binding is removed from Dexie Observable.
NOTE: You have to bind to a query that returns a collection, so binding on something like first() doesn't work.
ngDexieBind service. This will provide you with the
$dexieBind variable you can create new bindings from.
There are some unit tests written and included for this library. It's not a fully featured suite yet, but I hope to eventually get it there. Any contributions to this extension are most welcome!