Skip to main content
This example demonstrates how to use OpenAPI TypeScript with Angular applications, leveraging Angular’s dependency injection and RxJS.

Configuration

OpenAPI TypeScript Config

Create openapi-ts.config.ts in your project root:
openapi-ts.config.ts
Key features:
  • @hey-api/client-angular - Angular-specific HTTP client
  • operations.strategy: 'byTags' - Groups operations by OpenAPI tags into services
  • operations.containerName: '{{name}}Service' - Names services with “Service” suffix

Package Dependencies

package.json

Application Setup

App Configuration

Configure the Angular application with HTTP client and Hey API providers:
src/app/app.config.ts

Usage

Component with Dependency Injection

src/app/demo/demo.ts

Template

src/app/demo/demo.html

Key Features

Type Safety

All API calls are fully typed:

Dependency Injection

Services are injectable Angular services:

Multiple Clients

Support for local and global clients:

Running the Example

1

Clone the repository

2

Install dependencies

3

Run the Angular example

4

Open in browser

Navigate to http://localhost:4200

Full Example

View the complete example in the repository: Angular Example on GitHub

Learn More

Client Configuration

SDK Plugin

Schemas Plugin

Examples Overview