Registry / database / angular-sqlite

angular-sqlite

JSON →
library0.1.0jsnpmunverified

An AngularJS module that wraps client-side SQLite databases (Web SQL) with promises and table creation helpers. Version 0.1.0 (stable, low activity). Provides $SQLite service with methods like createTable, insert, replace, selectAll, selectFirst, execute. Depends on AngularJS and Web SQL (browser only). No TypeScript definitions. Last release Dec 2015; project appears maintenance-only or abandoned.

npm install angular-sqlite
INSTALL
IMPORT
SIG · ANGULAR-SQLITE
A
angular-sqlite
databasejavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ngSQLite
angular.module('myApp', [require('angular-sqlite')])
angular.module('myApp', ['ngSQLite'])
When using npm (CommonJS), you must pass the require() result as a module name string. The Bower pattern uses the string 'ngSQLite' directly.
$SQLite
angular.module('myApp').factory('MyService', function($SQLite) { ... })
angular.module('myApp').factory('MyService', ['$sqlite', function($sqlite) { ... }])
Service name is case-sensitive: $SQLite (capital S, capital Q, capital L). Lowercase variants will not be injected.
DB_CONFIG
angular.module('myApp').constant('DB_CONFIG', { ... })
angular.module('myApp').value('DB_CONFIG', { ... })
The README example uses .constant() for table schema. Using .value() works but is semantically less appropriate for configuration.

AngularJS app with SQLite module: configures DB, creates tables from constant, and exposes a factory with async CRUD using promises.

const angular = require('angular'); const sqlite = require('angular-sqlite'); const app = angular.module('myApp', [sqlite]); app.constant('DB_CONFIG', { users: { id: 'key', name: { type: 'text', null: false }, email: { type: 'text' } } }); app.run(function($SQLite, DB_CONFIG) { $SQLite.dbConfig({ name: 'mydb', description: 'test', version: '1.0' }); $SQLite.init(function(init) { angular.forEach(DB_CONFIG, function(config, name) { init.step(); $SQLite.createTable(name, config).then(init.done); }); init.finish(); }); }); app.factory('UserService', function($SQLite) { return { getById: function(id) { return new Promise(function(resolve, reject) { $SQLite.ready(function() { this.selectFirst('SELECT * FROM users WHERE id = ? LIMIT 1', [id]) .then(reject, reject, function(data) { resolve(data.item); }); }); }); }, create: function(user) { return new Promise(function(resolve, reject) { $SQLite.ready(function() { this.insert('users', user).then(resolve, reject); }); }); } }; });
Debug
Known issues
gotchaWeb SQL is deprecated in favor of IndexedDB. Browsers may remove support. Not available in all modern browsers (e.g., Firefox).
fix
Consider migrating to a library like Dexie.js or sql.js with IndexedDB or WebAssembly.
affects: >=0.0.0
breakingThe dependency on AngularJS (1.x) means this library is tied to an outdated framework. Angular (2+) requires different architecture.
fix
Use only with AngularJS 1.x projects. For newer Angular, use different SQLite bindings (e.g., with Capacitor, Cordova, or sql.js).
affects: >=0.0.0
gotchaThe $SQLite service uses .ready() with this context bound to the service, but inside callbacks this may not be what you expect if using arrow functions or different scopes.
fix
Always use $SQLite.ready(function() { ... }) with function() (not arrow) and access methods via this inside the callback.
affects: >=0.0.0
deprecatedThis package has not been updated since 2015. Node.js and npm ecosystems have changed significantly.
fix
For new projects, use a maintained library like sql.js (for Web SQL/IndexedDB) or integrate with a modern backend.
affects: >=0.0.0
gotchaThe promise chain uses .then(onEmpty, onError, onResult) with three callbacks (non-standard). The first two are for empty results and errors, third for success.
fix
Read the source carefully. The third callback receives {rows, count, result}. Most standard Promise usage expects .then(success, error).
affects: >=0.0.0
Errors
Common errors & fixes
Error: [$injector:modulerr] Failed to instantiate module myApp due to: Error: [$injector:nomod] Module 'ngSQLite' is not available!
Using Bower-style module string 'ngSQLite' when package was installed via npm (CommonJS).
fix
Use angular.module('myApp', [require('angular-sqlite')]) instead of 'ngSQLite'.
TypeError: Cannot read property 'ready' of undefined
Injecting $SQLite with wrong casing (e.g., $sqlite instead of $SQLite).
fix
Ensure injection name matches exactly: $SQLite (capital S, Q, L).
SecurityError: The operation is insecure.
Web SQL is disabled in some browsers (e.g., Firefox) or in certain contexts (file:// protocol).
fix
Use a supported browser (Chrome, Safari, Edge) or serve over HTTP/HTTPS. For unsupported browsers, use a fallback to IndexedDB.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
angularrequiredAngularJS (1.x) framework dependency, required at runtime
Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources
angular-sqlite — npm install angular-sqlite · libregistry