Registry / database / angular_record_store

angular_record_store

JSON →
library3.0.19jsnpmunverified

An ActiveRecord-like ORM for AngularJS built on LokiJS. Version 3.0.19 is the latest stable release. Designed specifically for Rails apps using Active Model Serializers, it provides client-side model definitions with relationships (hasMany, belongsTo), indices, default values, and computed attributes. It uses a single-source-of-truth approach for records and supports snake_case to camelCase conversion. The library is unmaintained since 2017, incompatible with Angular 2+ and modern Node.js.

npm install angular_record_store
INSTALL
IMPORT
SIG · ANGULAR_RECORD_STO
A
angular_record_store
databasejavascriptv3.0.19
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.

BaseModel
import { BaseModel } from 'angular-record-store';
const BaseModel = require('angular-record-store').BaseModel;
Package is CommonJS, but TypeScript users often mistakenly use ES import syntax. Correct usage is via require or Angular dependency injection.
angularRecordStore
angular.module('myApp', ['angular-record-store']);
angular.module('myApp').requires.push('angular-record-store');
Register the module via angular.module dependencies array, not by pushing to requires.
RestfulClient
var RestfulClient = require('angular-record-store').RestfulClient;
import { RestfulClient } from 'angular-record-store';
RestfulClient is not a named export in ES module sense; it's a constructor available on the main export.

Defines a Dog model with relationships and default values, registers it in an AngularJS module.

// In your AngularJS app angular.module('myApp', ['angular-record-store']) .factory('Dog', function(BaseModel) { return BaseModel.extend({ singular: 'dog', plural: 'dogs', indices: ['ownerId'], defaultValues: function() { return { name: null, age: 0, isFluffy: true }; }, relationships: function() { this.hasMany('fleas', { from: 'fleas', with: 'dogId' }); this.belongsTo('owner', { from: 'people' }); }, instanceMethods: { ownerName: function() { return this.owner() && this.owner().name; } } }); });
Debug
Known issues
deprecatedPackage is unmaintained since 2017. No updates for Angular 2+ or modern JavaScript.
fix
Migrate to a modern ORM like ngx-orm or use Angular services with a database library.
affects: *
breakingVersion 3.x changed the module name from 'angular-record-store' to 'angular_record_store'. If you used the old name, your app will break.
fix
Use the new module name: angular.module('myApp', ['angular_record_store'])
affects: >=3.0.0 <3.0.0
gotchaThe library requires LokiJS as a peer dependency. Not including lokijs before loading the module will cause runtime errors.
fix
Add lokijs to your project: npm install lokijs
affects: *
gotchaThe BaseModel.extend() method must be called with a properties object that includes singular and plural strings. Omitting them will cause silent failures.
fix
Always provide singular and plural in your model definition.
affects: *
deprecatedThe RestfulClient is deprecated in favor of using Angular's $http service directly. It may be removed in future versions.
fix
Use $http service from AngularJS instead of RestfulClient.
affects: >=2.0.0
gotchaRecords are stored globally in a single LokiJS instance. If you create multiple Angular apps, they will share the same data store.
fix
Use different collection names or isolate your apps if needed.
affects: *
Errors
Common errors & fixes
Cannot read property 'extend' of undefined
BaseModel is not injected correctly or the module is not loaded.
fix
Ensure 'angular-record-store' is listed in your module dependencies and inject BaseModel correctly.
Loki is not defined
LokiJS is not loaded before angular-record-store.
fix
Add <script src='lokijs.min.js'></script> before angular-record-store script.
angular_record_store is not a function
Using ES6 import syntax on a CommonJS module without proper bundler configuration.
fix
Use require() or configure your bundler to handle CommonJS modules.
Upgrade
Version history
3.0.19latest on npm
Audit
Dependencies
lokijsrequiredCore dependency: LokiJS is used as the underlying database engine.
angularrequiredPeer dependency: designed for AngularJS (1.x). Not compatible with Angular 2+.
Agent activity
22 hits · last 30 days
node
16
Bingbot
3
OpenAI (training)
1
Resources
angular_record_store — npm install angular_record_store · libregistry