Registry / database / ng-orm

ng-orm

JSON →
library0.0.5jsnpmunverified

REST API ORM for Angular 2+. Version 0.0.5, last updated in 2017, no longer actively maintained. Provides a fluent, resource-based interface for CRUD operations on RESTful endpoints with support for mocking. Based on ng2-rest, designed for AngularClass/webpack-starter and Angular CLI. Offers SimpleResource and Resource patterns, allowing model definitions and chained query building. Includes mocking capabilities for testing. Not compatible with Angular 4+ or modern versions; users should consider alternatives like @ngx-resource/core or Angular's HttpClient with RxJS.

npm install ng-orm
INSTALL
IMPORT
SIG · NG-ORM
N
ng-orm
databasejavascriptv0.0.5
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.

Resource
import { Resource } from 'ng-orm/ng-orm'
import { Resource } from 'ng-orm'
Import path must include '/ng-orm' subpath; top-level package export does not exist
SimpleResource
import { SimpleResource } from 'ng-orm/ng-orm'
import { SimpleResource } from 'ng-orm/simple-resource'
SimpleResource is exported from same subpath as Resource, not a separate file
MockRequest or MockResponse
import { MockRequest, MockResponse } from 'ng-orm/ng-orm'
import MockRequest from 'ng-orm'
Mock types are named exports from the same subpath

Shows basic setup: import Resource, register base URL, add a model endpoint, and perform a GET query.

import { NgModule } from '@angular/core'; import { Resource } from 'ng-orm/ng-orm'; @Injectable() class UserService { constructor(private rest: Resource<string, any, any[]>) { Resource.map('API', 'http://localhost:3000/api'); this.rest.add('API', 'users'); } getUsers() { return this.rest.api('API', 'users').query(); } } @NgModule({ imports: [Resource], providers: [UserService] }) export class AppModule {}
Debug
Known issues
breakingImport path requires subpath 'ng-orm/ng-orm' instead of just 'ng-orm'
fix
Use import { Resource } from 'ng-orm/ng-orm'
affects: >=0.0.1
deprecatedPackage is unmaintained, no updates since 2017, incompatible with Angular 4+
fix
Migrate to @ngx-resource/core or use Angular HttpClient directly
affects: >=0.0.1
gotchaResource is both a module to import via @NgModule and a class; confusion between usage
fix
Import Resource class for services, add to imports array only if using Resource as Angular module
affects: <=0.0.5
gotchaRxJS Subscription type must be imported from 'rxjs' not 'rxjs/Subscription' in modern RxJS
fix
import { Subscription } from 'rxjs'
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'ng-orm'
Import path is incorrect; must use 'ng-orm/ng-orm'
fix
Use import { Resource } from 'ng-orm/ng-orm'
Property 'map' does not exist on type 'typeof Resource'
Static method map is not called on the class correctly
fix
Call Resource.map('API', 'url') after importing Resource class
Type 'Resource<...>' is not assignable to type 'ResourceModule'
Trying to use Resource class in imports array without proper module setup
fix
Either import the Resource as a module or only use it as a service, not both
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies
@angular/corerequiredCore Angular dependency for decorators and DI
rxjsrequiredUsed for Observables and Subscription handling
Agent activity
6 hits · last 30 days
node
6
Resources
packageng-orm
ng-orm — npm install ng-orm · libregistry