• 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":"t11","5":"t12"},"c":{"4":[],"5":[{"i":"t12","r":1}]}}]}},{"t":{"0":"t15","2":"t16","3":"t24"},"c":{"0":[],"2":[{"i":"t15","r":1,"t":{"2":"t17"},"c":{"2":[{"i":"t17","r":13,"n":{"3":"hfnf"},"t":{"3":"t18","5":"t19"},"c":{"3":[],"5":[{"i":"t19","r":1,"n":{"2":"0f"},"t":{"2":"t20","3":"t21","4":"t28"},"c":{"2":[{"i":"t20","r":4,"t":{"0":"t30","1":"t31"},"c":{"0":[],"1":[{"i":"t31","r":2,"c":{"0":[],"3":[{"i":"t24","r":2,"t":{"0":"t25","1":"t26"},"c":{"0":[],"1":[]}}],"4":[]},"t":{"3":"t32","4":"t33"}}]}}],"3":[],"4":[]}},{"i":"t19","r":1,"n":{"2":"0f"},"t":{"2":"t20","3":"t21","4":"t28"},"c":{"2":[{"i":"t20","r":4,"t":{"0":"t30","1":"t31"},"c":{"0":[{"i":"t30","r":2,"c":{"0":[],"3":[]},"t":{"3":"t36"}}],"1":[]}}],"3":[],"4":[]}},{"i":"t19","r":1,"n":{"2":"0f"},"t":{"2":"t20","3":"t21","4":"t28"},"c":{"2":[],"3":[{"i":"t21","r":4,"t":{"0":"t22","1":"t27"},"c":{"0":[],"1":[{"i":"t27","r":2,"c":{"0":[],"2":[],"5":[{"i":"t24","r":2,"t":{"0":"t25","1":"t26"},"c":{"0":[],"1":[]}}]},"t":{"2":"t34","5":"t35"}}]}}],"4":[]},"x":4},{"i":"t19","r":1,"n":{"2":"0f"},"t":{"2":"t20","3":"t21","4":"t28"},"c":{"2":[{"i":"t20","r":4,"t":{"0":"t30","1":"t31"},"c":{"0":[],"1":[{"i":"t31","r":2,"c":{"0":[],"3":[{"i":"t24","r":2,"t":{"0":"t25","1":"t26"},"c":{"0":[],"1":[]}}],"4":[]},"t":{"3":"t32","4":"t33"}}]}}],"3":[],"4":[]},"x":3},{"i":"t19","r":1,"n":{"2":"0f"},"t":{"2":"t20","3":"t21","4":"t28"},"c":{"2":[],"3":[{"i":"t21","r":4,"t":{"0":"t22","1":"t27"},"c":{"0":[],"1":[{"i":"t27","r":2,"c":{"0":[],"2":[],"5":[{"i":"t24","r":2,"t":{"0":"t25","1":"t26"},"c":{"0":[],"1":[]}}]},"t":{"2":"t34","5":"t35"}}]}}],"4":[]},"x":2}]}}]}}],"3":[]}},{"t":{"0":"t15","2":"t16","3":"t24"},"c":{"0":[],"2":[{"i":"t15","r":1,"t":{"2":"t17"},"c":{"2":[{"i":"t17","r":3,"n":{"3":"hfnf"},"t":{"3":"t18","5":"t19"},"c":{"3":[],"5":[{"i":"t19","r":1,"n":{"2":"0f"},"t":{"2":"t20","3":"t21","4":"t28"},"c":{"2":[],"3":[{"i":"t21","r":4,"t":{"0":"t22","1":"t27"},"c":{"0":[],"1":[{"i":"t27","r":2,"c":{"0":[],"2":[{"i":"t34","r":1,"n":{"1":"0f"}}],"5":[{"i":"t24","r":2,"t":{"0":"t25","1":"t26"},"c":{"0":[],"1":[]}}]},"t":{"2":"t34","5":"t35"}}]}}],"4":[{"i":"t28","r":2,"t":{"0":"t29"},"c":{"0":[{"i":"t15","r":1,"t":{"2":"t17"},"c":{"2":[{"i":"t17","r":51,"n":{"3":"hfnfnfn6f"},"t":{"3":"t18","5":"t19"},"c":{"3":[],"5":[{"i":"t19","r":1,"n":{"2":"0f"},"t":{"2":"t20","3":"t21","4":"t28"},"c":{"2":[{"i":"t20","r":4,"t":{"0":"t30","1":"t31"},"c":{"0":[],"1":[{"i":"t31","r":2,"c":{"0":[],"3":[{"i":"t24","r":2,"t":{"0":"t25","1":"t26"},"c":{"0":[],"1":[]}}],"4":[]},"t":{"3":"t32","4":"t33"}}]}}],"3":[],"4":[]}},{"i":"t19","r":1,"n":{"2":"0f"},"t":{"2":"t20","3":"t21","4":"t28"},"c":{"2":[],"3":[{"i":"t21","r":4,"t":{"0":"t22","1":"t27"},"c":{"0":[],"1":[{"i":"t27","r":2,"c":{"0":[],"2":[],"5":[{"i":"t24","r":2,"t":{"0":"t25","1":"t26"},"c":{"0":[],"1":[]}}]},"t":{"2":"t34","5":"t35"}}]}}],"4":[]},"x":48}]}}]}}]}}]}}]}}]}}],"3":[]}},{"t":{"0":"t15","2":"t16","3":"t24"},"c":{"0":[],"2":[{"i":"t15","r":1,"t":{"2":"t17"},"c":{"2":[{"i":"t17","r":3,"n":{"3":"hfnf"},"t":{"3":"t18","5":"t19"},"c":{"3":[],"5":[{"i":"t19","r":1,"n":{"2":"0f"},"t":{"2":"t20","3":"t21","4":"t28"},"c":{"2":[],"3":[{"i":"t21","r":4,"t":{"0":"t22","1":"t27"},"c":{"0":[],"1":[{"i":"t27","r":2,"c":{"0":[],"2":[{"i":"t34","r":1,"n":{"1":"0f"}}],"5":[{"i":"t24","r":2,"t":{"0":"t25","1":"t26"},"c":{"0":[],"1":[]}}]},"t":{"2":"t34","5":"t35"}}]}}],"4":[{"i":"t28","r":2,"t":{"0":"t29"},"c":{"0":[{"i":"t15","r":1,"t":{"2":"t17"},"c":{"2":[{"i":"t17","r":280,"n":{"3":"hfnfnfn6f"},"t":{"3":"t18","5":"t19"},"c":{"3":[],"5":[{"i":"t19","r":1,"n":{"2":"0f"},"t":{"2":"t20","3":"t21","4":"t28"},"c":{"2":[{"i":"t20","r":4,"t":{"0":"t30","1":"t31"},"c":{"0":[],"1":[{"i":"t31","r":2,"c":{"0":[],"3":[{"i":"t24","r":2,"t":{"0":"t25","1":"t26"},"c":{"0":[],"1":[]}}],"4":[]},"t":{"3":"t32","4":"t33"}}]}}],"3":[],"4":[]},"x":278}]}}]}}]}}]}}]}}]}}],"3":[]}},{"t":{"2":"t14","4":"t37"},"c":{"2":[{"i":"t14","r":1}],"4":[{"i":"t37","r":1,"x":2}]}},{"t":{"0":"t47"},"c":{"0":[{"i":"t47","r":2,"c":{"0":[]}}]}},{"c":{"0":[{"i":"c972174807","r":1}]}},{"t":{"2":"t0","3":"t1","6":"t13","8":"t38","9":"t39","12":"t41"},"c":{"2":[],"3":[],"6":[{"i":"t13","r":1}],"8":[],"9":[],"11":[{"i":"c2556530580","r":1}],"12":[{"i":"t41","r":1}]}},{"t":{"7":"t45"},"c":{"7":[]},"n":{"10":"9f"}}]}