Registry / devops / angular-rest-adapter

angular-rest-adapter

JSON →
library2.0.1jsnpmunverified

Angular REST http request adapter wrapping angular's native $http service to simplify REST API communication. Current version 2.0.1 provides TypeScript definitions, supports Angular 1.x, and offers a provider-based configuration for base URL and default headers. Its key differentiator is seamless integration with Angular 1's dependency injection, making it a lightweight alternative to full-fledged REST clients. The package is in maintenance mode with infrequent updates.

npm install angular-rest-adapter
INSTALL
IMPORT
SIG · ANGULAR-REST-ADAPT
A
angular-rest-adapter
devopsjavascriptv2.0.1
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.

angular-rest-adapter (module side-effect import)
import 'angular-rest-adapter';
import { something } from 'angular-rest-adapter';
Module import registers 'ngRestAdapter' module. Use import 'angular-rest-adapter' for side effects.
NgRestAdapterServiceProvider
import { NgRestAdapterServiceProvider } from 'angular-rest-adapter';
import { NgRestAdapterProvider } from 'angular-rest-adapter';
Correct symbol includes 'Service' in the name.
ngRestAdapter (injection token)
inject string 'ngRestAdapter' (no import needed for injection)
import { ngRestAdapter } from 'angular-rest-adapter';
The service is injected by string name in Angular 1, not imported as a module symbol.

Demonstrates importing the module, configuring the provider with a base URL, and using the ngRestAdapter service to make a GET request.

import angular from 'angular'; import 'angular-rest-adapter'; angular.module('app', ['ngRestAdapter']) .config(['ngRestAdapterProvider', function(ngRestAdapterProvider) { ngRestAdapterProvider.configure({ baseUrl: process.env.API_BASE_URL ?? 'http://localhost:3000/api' }); }]) .run(['ngRestAdapter', function(ngRestAdapter) { ngRestAdapter.get('/items').then(response => { console.log(response.data); }); }]);
Debug
Known issues
breakingVersion 2.0.0 changed the injection name from 'restAdapter' to 'ngRestAdapter'
fix
Update dependency injection references to use 'ngRestAdapter' instead of 'restAdapter'.
affects: >=2.0.0
deprecatedBower installation is deprecated and no longer maintained
fix
Use npm to install the package.
affects: >=1.0.0
gotchaConfiguring baseUrl with trailing slash may cause double slashes in request URLs
fix
Ensure baseUrl does not end with a trailing slash.
affects: >=1.0.0
gotchaService factory does not provide error interceptors; all errors handled via $http error callback
fix
Implement error handling in the promise chain from ngRestAdapter calls.
affects: >=1.0.0
Errors
Common errors & fixes
Error: [$injector:modulerr] Failed to instantiate module ngRestAdapter
Missing import of 'angular-rest-adapter' before defining the app module.
fix
Add import 'angular-rest-adapter'; at the top of your entry file.
TypeError: Cannot read property 'configure' of undefined
Provider not injected correctly; config function expects array-annotated injection.
fix
Use array annotation: ['ngRestAdapterProvider', function(provider) { ... }]
ReferenceError: ngRestAdapter is not defined
Using 'ngRestAdapter' as an import symbol instead of injecting it as a string.
fix
Inject the service via Angular's DI, e.g., run(['ngRestAdapter', function(adapter) { ... }])
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies
angularrequiredPeer dependency required for $http and module registration
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
angular-rest-adapter — npm install angular-rest-adapter · libregistry