跳到主要内容

useGet()

function useGet<T>(EntityType, options): RxDBResource<InstanceType<T> | undefined>;

Defined in: rxdb-angular/src/hooks.ts:142

通过 ID 获取单个实体

Type Parameters​

Type Parameter
T extends EntityType

Parameters​

ParameterTypeDescription
EntityTypeT实体类
optionsUseOptions<EntityStaticType<T, "getOptions">>实体 ID 或查询参数对象

Returns​

RxDBResource<InstanceType<T> | undefined>

返回包含实体的资源 signal

Example​

const user = useGet(User, 'user-1');