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:

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:

exampleService->enableObserve();

Last updated