• Overview
@angular/common/http

HttpResourceRef

interface

A WritableResource that represents the results of a reactive HTTP request.

API

  
    interface HttpResourceRef<T> extends WritableResource<T> {}
  
  

headers

Signal<HttpHeaders | undefined>

Signal of the response headers, when available.

statusCode

Signal<number | undefined>

Signal of the response status code, when available.

progress

Signal<HttpProgressEvent | undefined>

Signal of the latest progress update, if the request was made with reportProgress: true.

hasValue

boolean
@returnsboolean

destroy

void
@returnsvoid

set

void

Convenience wrapper for value.set.

@paramvalueT
@returnsvoid

update

void

Convenience wrapper for value.update.

@paramupdater(value: T) => T
@returnsvoid

asReadonly

Resource<T>
@returnsResource<T>

status

Signal<ResourceStatus>

The current status of the Resource, which describes what the resource is currently doing and what can be expected of its value.

error

Signal<unknown>

When in the error state, this returns the last known error from the Resource.

isLoading

Signal<boolean>

Whether this resource is loading a new value (or reloading the existing one).

reload

boolean

Instructs the resource to re-load any asynchronous dependency it may have.

Note that the resource will not enter its reloading state until the actual backend request is made.

@returnsboolean

Description

A WritableResource that represents the results of a reactive HTTP request.

HttpResources are backed by HttpClient, including support for interceptors, testing, and the other features of the HttpClient API.

Jump to details