@ApiServiceObservable
Marks a service as observable so function subscribers are executed before/after each CRUD method and whenever an error occurs. Without this decorator, ApiFunctionSubscriber classes are ignored for the service.
Signature
@ApiServiceObservable()Behavior
- Adds the
SERVICE_API_DECORATOR_CONSTANT.OBSERVABLE_METADATA_KEYflag to the service constructor. ApiFunctionSubscriberregistries inspect this metadata before invoking subscribers, preventing accidental fan-out on services that are not opt-in.- Works with both
@ApiService-generated methods and custom methods that manually executeApiSubscriberExecutor.
Example
@Injectable()
@ApiService({ entity: PostEntity })
@ApiServiceObservable()
export class PostService extends ApiServiceBase<PostEntity> {}Related resources
Last updated on