> For the complete documentation index, see [llms.txt](https://henryruhs.gitbook.io/ngx-crud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://henryruhs.gitbook.io/ngx-crud/examples/effects.md).

# Effects

Provide the `EffectService` inside your `AppModule`:

```
import { NgModule } from '@angular/core';
import { OBSERVE_EFFECT } from 'ngx-crud';
import { ExampleEffect } from './example.effect';

@NgModule(
{
	providers:
	[
		{
			provide: OBSERVE_EFFECT,
			useClass: ExampleEffect
		}
	]
})
export class AppModule
{
}
```

Implement the `ExampleEffect` as needed:&#x20;

```typescript
import { Injectable } from '@angular/core';
import { HttpErrorResponse, HttpRequest, HttpResponse } from '@angular/common/http';
import { ObserveBeforeEffect, ObserveAfterEffect } from 'ngx-crud';

@Injectable()
export class ExampleEffect implements ObserveBeforeEffect, ObserveAfterEffect
{
	before<T>(request : HttpRequest<T>) : HttpRequest<T>
	{
	}

	after<T>(request : HttpRequest<T>, response : HttpResponse<T> | HttpErrorResponse) : void
	{
	}
}
```

Enable observing for the service:

```typescript
exampleService->enableObserve();
```
