• Overview
@angular/core

ResourceRef

interface

A WritableResource created through the resource function.

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

destroy

void

Manually destroy the resource, which cancels pending requests and returns it to idle state.

@returnsvoid

value

WritableSignal<T | undefined>

hasValue

boolean
@returnsboolean

set

void

Convenience wrapper for value.set.

@paramvalueT | undefined
@returnsvoid

update

void

Convenience wrapper for value.update.

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

asReadonly

@returnsResource<T>

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
Jump to details