Registry / storage / angular4-hal

angular4-hal

JSON →
library7.11.2jsnpmunverified

Angular module providing a HAL/JSON HTTP client for interacting with Spring Data Rest APIs. Current stable version 7.11.2 requires Angular ^7.0.0 and RxJS ^6.0.0. Ships TypeScript definitions. Unlike generic HTTP clients, this library specializes in Hypertext Application Language (HAL) and Spring Data Rest resource models, offering automatic resource deserialization, linking, and navigation. Release cadence is low; the library is in maintenance mode. Key differentiator: seamless integration with Spring Boot backends.

npm install angular4-hal
INSTALL
IMPORT
SIG · ANGULAR4-HAL
A
angular4-hal
storagejavascriptv7.11.2
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.

HalModule
import { HalModule } from 'angular4-hal';
import { HalModule } from 'angular4-hal/src/hal';
Use main export; avoid deep imports.
RestService
import { RestService } from 'angular4-hal';
const RestService = require('angular4-hal').RestService;
ESM only; require() will fail in Angular CLI/webpack setups.
Resource
import { Resource } from 'angular4-hal';
import { Resource } from 'angular4-hal/resource';
Resource is a named export from the main module.
HalConfiguration
import { HalConfiguration } from 'angular4-hal';
import { HalConfig } from 'angular4-hal';
Configuration class is named HalConfiguration, not HalConfig.

Shows setting up HalModule with configuration and using RestService to fetch HAL resources.

import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HalModule, Resource, RestService } from 'angular4-hal'; import { HttpClientModule } from '@angular/common/http'; class MyResource extends Resource { id: number; name: string; } @NgModule({ imports: [ BrowserModule, HttpClientModule, HalModule.forRoot({ apiUrl: process.env['API_URL'] ?? 'http://localhost:8080/api' }) ], providers: [RestService] }) export class AppModule {} // In a component: @Component({...}) export class MyComponent { constructor(private rest: RestService) {} ngOnInit() { this.rest.getAll<MyResource>('items').subscribe(items => console.log(items)); } }
Debug
Known issues
breakingPackage version 7.x is only compatible with Angular 7.
fix
Use angular4-hal 6.x for Angular 6, or 5.x for Angular 5.
affects: >=7.0.0 <8.0.0
breakingSince v7, RestService methods return Observable instead of Promise.
fix
Update to use .subscribe() or .toPromise() as needed.
affects: >=7.0.0
deprecatedHalModule.forRoot() is deprecated; use provideHalConfig() instead.
fix
Use provideHalConfig({ apiUrl: '...' }) in providers.
affects: >=7.0.0 <7.12.0
gotchaResource class requires a default constructor with no arguments.
fix
Ensure Resource subclasses have a default constructor.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Can't resolve 'angular4-hal' in ...
Missing dependency or wrong import path.
fix
Run npm install angular4-hal --save and import from 'angular4-hal'.
ERROR in node_modules/angular4-hal/lib/hal.d.ts:1:22 - error TS2688: Cannot find type definition file for '...'.
TypeScript version mismatch or missing @types/angular.
fix
Install @types/angular or downgrade TypeScript to 2.9.x.
No provider for HalConfiguration!
HalModule not imported or not configured correctly.
fix
Add HalModule.forRoot({...}) to imports array of NgModule.
Upgrade
Version history
7.11.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
41 hits · last 30 days
node
34
OpenAI (training)
1
Resources
angular4-hal — npm install angular4-hal · libregistry