• Overview
@angular/common/http

HttpResourceOptions

interface

Options for creating an httpResource.

API

  
    interface HttpResourceOptions<TResult, TRaw> {}
  
  

parse

((value: TRaw) => TResult) | undefined

Transform the result of the HTTP request before it's delivered to the resource.

parse receives the value from the HTTP layer as its raw type (e.g. as unknown for JSON data). It can be used to validate or transform the type of the resource, and return a more specific type. This is also useful for validating backend responses using a runtime schema validation library such as Zod.

defaultValue

NoInfer<TResult> | undefined

Value that the resource will take when in Idle, Loading, or Error states.

If not set, the resource will use undefined as its default value.

injector

Injector | undefined

The Injector in which to create the httpResource.

If this is not provided, the current injection context will be used instead (via inject).

equal

ValueEqualityFn<NoInfer<TResult>> | undefined

A comparison function which defines equality for the response value.

Jump to details