• Overview
@angular/core

resource

function

Constructs a Resource that projects a reactive request to an asynchronous operation defined by a loader function, which exposes the result of the loading operation via signals.

  
    function resource<T, R>(  options: ResourceOptions<T, R>): ResourceRef<T>;
  
  

resource

Constructs a Resource that projects a reactive request to an asynchronous operation defined by a loader function, which exposes the result of the loading operation via signals.

Note that resource is intended for read operations, not operations which perform mutations. resource will cancel in-progress loads via the AbortSignal when destroyed or when a new request object becomes available, which could prematurely abort mutations.

@paramoptionsResourceOptions<T, R>
@returnsResourceRef<T>
Jump to details