Skip to main content

Angular

Start by providing an OpenAPI specification and an Orval config file. To use Angular, define the mode in the Orval config to be angular.

Example with angular

module.exports = {
petstore: {
output: {
mode: 'tags-split',
target: 'src/petstore.ts',
schemas: 'src/model',
client: 'angular',
mock: true,
},
input: {
target: './petstore.yaml',
},
},
};

Navigate to the Orval config reference to see all available options.

The Angular client will automatically generate two classes:

  1. An abstract class with the definition
  2. A service with the implementation. Add the service inside a module to use it where you need it.

Check out an example here

How to Set a Backend URL

Use an interceptor to automatically add an API URL, similar to how an authorization header is added.

Was this page helpful?