• Genel Bakış
@angular/core

Resource

interface
kararlıv22.0'den beri

A Resource is an asynchronous dependency (for example, the results of an API call) that is managed and delivered through signals.

API

    
      interface Resource<T> {
}

value

Signal<T>

The current value of the Resource, or throws an error if the resource is in an error state.

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<Error | undefined>

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).

snapshot

Signal<ResourceSnapshot<T>>

The current state of this resource, represented as a ResourceSnapshot.

hasValue

2 overloads

Whether this resource has a valid current value.

This function is reactive.

@paramthisT extends undefined ? this : never
@returnsthis is Resource<Exclude<T, undefined>>
@returnsboolean

Description

A Resource is an asynchronous dependency (for example, the results of an API call) that is managed and delivered through signals.

The usual way of creating a Resource is through the resource function, but various other APIs may present Resource instances to describe their own concepts.

Detaylara atla
\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>","h":{},"s":200,"st":"OK","u":"assets\u002Fcontent\u002Fapi\u002Fangular_core_resource_function.html","rt":"text"},"__nghData__":[{},{"n":{"21":"20f","33":"32f","90":"89f","96":"95f"},"t":{"37":"t2","38":"t3","44":"t4","91":"t5","96":"t6","97":"t7","98":"t8","99":"t9","101":"t10"},"c":{"37":[{"i":"t2","r":1}],"38":[],"40":[],"44":[],"88":[],"91":[],"94":[],"96":[],"97":[],"98":[],"99":[],"101":[{"i":"t10","r":1,"n":{"3":"2f"},"t":{"4":"t25","5":"t26"},"c":{"4":[],"5":[{"i":"t26","r":1}]}}]}},{"t":{"0":"t28","2":"t29","3":"t37"},"c":{"0":[],"2":[{"i":"t28","r":1,"t":{"2":"t30"},"c":{"2":[{"i":"t30","r":13,"n":{"3":"hfnf"},"t":{"3":"t31","5":"t32"},"c":{"3":[],"5":[{"i":"t32","r":1,"n":{"2":"0f"},"t":{"2":"t33","3":"t41","4":"t42"},"c":{"2":[{"i":"t33","r":4,"t":{"0":"t34","1":"t35"},"c":{"0":[],"1":[{"i":"t35","r":2,"c":{"0":[],"3":[{"i":"t37","r":2,"t":{"0":"t38","1":"t39"},"c":{"0":[],"1":[]}}],"4":[]},"t":{"3":"t36","4":"t40"}}]}}],"3":[],"4":[]}},{"i":"t32","r":1,"n":{"2":"0f"},"t":{"2":"t33","3":"t41","4":"t42"},"c":{"2":[{"i":"t33","r":4,"t":{"0":"t34","1":"t35"},"c":{"0":[{"i":"t34","r":2,"c":{"0":[],"3":[]},"t":{"3":"t43"}}],"1":[]}}],"3":[],"4":[]}},{"i":"t32","r":1,"n":{"2":"0f"},"t":{"2":"t33","3":"t41","4":"t42"},"c":{"2":[],"3":[{"i":"t41","r":4,"t":{"0":"t44","1":"t45"},"c":{"0":[],"1":[{"i":"t45","r":2,"c":{"0":[],"2":[],"5":[{"i":"t37","r":2,"t":{"0":"t38","1":"t39"},"c":{"0":[],"1":[]}}]},"t":{"2":"t46","5":"t47"}}]}}],"4":[]},"x":4},{"i":"t32","r":1,"n":{"2":"0f"},"t":{"2":"t33","3":"t41","4":"t42"},"c":{"2":[{"i":"t33","r":4,"t":{"0":"t34","1":"t35"},"c":{"0":[],"1":[{"i":"t35","r":2,"c":{"0":[],"3":[{"i":"t37","r":2,"t":{"0":"t38","1":"t39"},"c":{"0":[],"1":[]}}],"4":[]},"t":{"3":"t36","4":"t40"}}]}}],"3":[],"4":[]},"x":3},{"i":"t32","r":1,"n":{"2":"0f"},"t":{"2":"t33","3":"t41","4":"t42"},"c":{"2":[],"3":[{"i":"t41","r":4,"t":{"0":"t44","1":"t45"},"c":{"0":[],"1":[{"i":"t45","r":2,"c":{"0":[],"2":[],"5":[{"i":"t37","r":2,"t":{"0":"t38","1":"t39"},"c":{"0":[],"1":[]}}]},"t":{"2":"t46","5":"t47"}}]}}],"4":[]},"x":2}]}}]}}],"3":[]}},{"t":{"0":"t28","2":"t29","3":"t37"},"c":{"0":[],"2":[{"i":"t28","r":1,"t":{"2":"t30"},"c":{"2":[{"i":"t30","r":3,"n":{"3":"hfnf"},"t":{"3":"t31","5":"t32"},"c":{"3":[],"5":[{"i":"t32","r":1,"n":{"2":"0f"},"t":{"2":"t33","3":"t41","4":"t42"},"c":{"2":[],"3":[{"i":"t41","r":4,"t":{"0":"t44","1":"t45"},"c":{"0":[],"1":[{"i":"t45","r":2,"c":{"0":[],"2":[{"i":"t46","r":1,"n":{"1":"0f"}}],"5":[{"i":"t37","r":2,"t":{"0":"t38","1":"t39"},"c":{"0":[],"1":[]}}]},"t":{"2":"t46","5":"t47"}}]}}],"4":[{"i":"t42","r":2,"t":{"0":"t51"},"c":{"0":[{"i":"t28","r":1,"t":{"2":"t30"},"c":{"2":[{"i":"t30","r":51,"n":{"3":"hfnfnfn6f"},"t":{"3":"t31","5":"t32"},"c":{"3":[],"5":[{"i":"t32","r":1,"n":{"2":"0f"},"t":{"2":"t33","3":"t41","4":"t42"},"c":{"2":[{"i":"t33","r":4,"t":{"0":"t34","1":"t35"},"c":{"0":[],"1":[{"i":"t35","r":2,"c":{"0":[],"3":[{"i":"t37","r":2,"t":{"0":"t38","1":"t39"},"c":{"0":[],"1":[]}}],"4":[]},"t":{"3":"t36","4":"t40"}}]}}],"3":[],"4":[]}},{"i":"t32","r":1,"n":{"2":"0f"},"t":{"2":"t33","3":"t41","4":"t42"},"c":{"2":[],"3":[{"i":"t41","r":4,"t":{"0":"t44","1":"t45"},"c":{"0":[],"1":[{"i":"t45","r":2,"c":{"0":[],"2":[],"5":[{"i":"t37","r":2,"t":{"0":"t38","1":"t39"},"c":{"0":[],"1":[]}}]},"t":{"2":"t46","5":"t47"}}]}}],"4":[]},"x":48}]}}]}}]}}]}}]}}]}}],"3":[]}},{"t":{"0":"t28","2":"t29","3":"t37"},"c":{"0":[],"2":[{"i":"t28","r":1,"t":{"2":"t30"},"c":{"2":[{"i":"t30","r":3,"n":{"3":"hfnf"},"t":{"3":"t31","5":"t32"},"c":{"3":[],"5":[{"i":"t32","r":1,"n":{"2":"0f"},"t":{"2":"t33","3":"t41","4":"t42"},"c":{"2":[],"3":[{"i":"t41","r":4,"t":{"0":"t44","1":"t45"},"c":{"0":[],"1":[{"i":"t45","r":2,"c":{"0":[],"2":[{"i":"t46","r":1,"n":{"1":"0f"}}],"5":[{"i":"t37","r":2,"t":{"0":"t38","1":"t39"},"c":{"0":[],"1":[]}}]},"t":{"2":"t46","5":"t47"}}]}}],"4":[{"i":"t42","r":2,"t":{"0":"t51"},"c":{"0":[{"i":"t28","r":1,"t":{"2":"t30"},"c":{"2":[{"i":"t30","r":280,"n":{"3":"hfnfnfn6f"},"t":{"3":"t31","5":"t32"},"c":{"3":[],"5":[{"i":"t32","r":1,"n":{"2":"0f"},"t":{"2":"t33","3":"t41","4":"t42"},"c":{"2":[{"i":"t33","r":4,"t":{"0":"t34","1":"t35"},"c":{"0":[],"1":[{"i":"t35","r":2,"c":{"0":[],"3":[{"i":"t37","r":2,"t":{"0":"t38","1":"t39"},"c":{"0":[],"1":[]}}],"4":[]},"t":{"3":"t36","4":"t40"}}]}}],"3":[],"4":[]},"x":278}]}}]}}]}}]}}]}}]}}],"3":[]}},{"t":{"2":"t27","4":"t48"},"c":{"2":[{"i":"t27","r":1}],"4":[{"i":"t48","r":1,"x":2}]}},{"t":{"0":"t59"},"c":{"0":[{"i":"t59","r":2,"c":{"0":[]}}]}},{"c":{"0":[{"i":"c2856249310","r":1}]}},{"t":{"2":"t0","3":"t1","6":"t11","8":"t12","9":"t13","12":"t24"},"c":{"2":[],"3":[],"6":[{"i":"t11","r":1}],"8":[],"9":[],"11":[{"i":"c1712022829","r":1}],"12":[{"i":"t24","r":1}]}},{"t":{"7":"t50"},"c":{"7":[]},"n":{"10":"9f"}}]}