Skip to content

HttpResourcePlugin

The HTTP Resource plugin generates Angular services using the httpResource API for automatic caching, state management, and reactive data loading.

Learn more in Angular Docs ↗️

Usage

typescript
// openapi.config.ts
import { GeneratorConfig } from 'ng-openapi';
import { HttpResourcePlugin } from '@ng-openapi/http-resource';

export default {
  plugins: [HttpResourcePlugin], // top-level, not inside `options`
  ... // other configurations
} as GeneratorConfig;

Notes

  • Scoped interceptors are applied for resources as well
  • Currently only supports GET methods, as suggested by Angular's documentation ↗️
  • Generated resource classes honor serviceDecorator, so services and resources always use the same decorator
  • Generated resource class names default to <Tag>Resource and can be decorated via naming.resources; model references follow naming.models

Released under the MIT License.
This site is powered by Netlify
About · Impressum