# Introduction

> CRUD services in Angular with effortless aborting, caching and observing.

### Installation

```bash
npm install ngx-crud
```

### Setup

Import the `CrudModule` and `HttpClientModule` inside your `AppModule`:

```typescript
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { CrudModule } from 'ngx-crud';

@NgModule(
{
	imports:
	[
		CrudModule
	],
	providers:
	[
		provideHttpClient(withInterceptorsFromDi())
	]
})
export class AppModule
{
}
```

### Usage

Extend the `ExampleService` from the `CrudService`:

```typescript
import { Injectable } from '@angular/core';
import { CrudService } from 'ngx-crud';
import { RequestBody, ResponseBody } from './example.interface';

import { environment } from '@environments';

@Injectable()
@ApiUrl(environment.apiUrl)
@ApiRoute(environment.apiRoutes.example)
export class ExampleService extends CrudService<RequestBody, ResponseBody>
{
}
```

Use the HTTP operations as needed:

```typescript
exampleService.create(body, options);
exampleService.read(id, options);
exampleService.find(options);
exampleService.update(id, body, options);
exampleService.patch(id, body, options);
exampleService.delete(id, options);
exampleService.custom(method, options);
```

### Playground

Visit the [playground](https://playground.ngx-crud.com/) to see aborting, caching and observing in action.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://henryruhs.gitbook.io/ngx-crud/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
