HttpResourceFn
Тип для функции верхнего уровня httpRequest, включающий сигнатуры вызова для httpRequest на основе JSON, а также подфункции для запросов типов ArrayBuffer, Blob и string.
API
interface HttpResourceFn {
<TResult = unknown>(url: (ctx: ResourceParamsContext) => string | undefined, options: HttpResourceOptions<TResult, unknown> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>;
<TResult = unknown>(url: (ctx: ResourceParamsContext) => string | undefined, options?: HttpResourceOptions<TResult, unknown> | undefined): HttpResourceRef<TResult | undefined>;
<TResult = unknown>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options: HttpResourceOptions<TResult, unknown> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>;
<TResult = unknown>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options?: HttpResourceOptions<TResult, unknown> | undefined): HttpResourceRef<TResult | undefined>;
arrayBuffer: { <TResult = ArrayBuffer>(url: (ctx: ResourceParamsContext) => string | undefined, options: HttpResourceOptions<TResult, ArrayBuffer> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>; <TResult = ArrayBuffer>(url: (ctx: ResourceParamsContext) => string | undefined, options?: HttpResourceOptions<TResult, ArrayBuffer> | undefined): HttpResourceRef<TResult | undefined>; <TResult = ArrayBuffer>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options: HttpResourceOptions<TResult, ArrayBuffer> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>; <TResult = ArrayBuffer>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options?: HttpResourceOptions<TResult, ArrayBuffer> | undefined): HttpResourceRef<TResult | undefined>; };
blob: { <TResult = Blob>(url: (ctx: ResourceParamsContext) => string | undefined, options: HttpResourceOptions<TResult, Blob> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>; <TResult = Blob>(url: (ctx: ResourceParamsContext) => string | undefined, options?: HttpResourceOptions<TResult, Blob> | undefined): HttpResourceRef<TResult | undefined>; <TResult = Blob>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options: HttpResourceOptions<TResult, Blob> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>; <TResult = Blob>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options?: HttpResourceOptions<TResult, Blob> | undefined): HttpResourceRef<TResult | undefined>; };
text: { <TResult = string>(url: (ctx: ResourceParamsContext) => string | undefined, options: HttpResourceOptions<TResult, string> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>; <TResult = string>(url: (ctx: ResourceParamsContext) => string | undefined, options?: HttpResourceOptions<TResult, string> | undefined): HttpResourceRef<TResult | undefined>; <TResult = string>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options: HttpResourceOptions<TResult, string> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>; <TResult = string>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options?: HttpResourceOptions<TResult, string> | undefined): HttpResourceRef<TResult | undefined>; };
}
HttpResourceRef<TResult>Создаёт Resource, получающий данные с помощью HTTP GET-запроса по указанному URL.
Ресурс будет обновляться при изменении URL через сигналы.
Для отправки запросов используется HttpClient. Поддерживаются интерсепторы, тестирование и другие возможности API HttpClient. По умолчанию данные разбираются как JSON. Чтобы иначе обработать ответ, используйте подфункцию httpResource, например httpResource.text().
HttpResourceRef<TResult>
HttpResourceRef<TResult | undefined>Создаёт Resource, получающий данные с помощью HTTP GET-запроса по указанному URL.
Ресурс будет обновляться при изменении URL через сигналы.
Для отправки запросов используется HttpClient. Поддерживаются интерсепторы, тестирование и другие возможности API HttpClient. По умолчанию данные разбираются как JSON. Чтобы иначе обработать ответ, используйте подфункцию httpResource, например httpResource.text().
HttpResourceRef<TResult | undefined>
HttpResourceRef<TResult>Создаёт Resource, получающий данные с помощью настроенного HTTP-запроса.
Ресурс будет обновляться при изменении запроса через сигналы.
Для отправки запросов используется HttpClient. Поддерживаются интерсепторы, тестирование и другие возможности API HttpClient. По умолчанию данные разбираются как JSON. Чтобы иначе обработать ответ, используйте подфункцию httpResource, например httpResource.text().
HttpResourceRef<TResult>
HttpResourceRef<TResult | undefined>Создаёт Resource, получающий данные с помощью настроенного HTTP-запроса.
Ресурс будет обновляться при изменении запроса через сигналы.
Для отправки запросов используется HttpClient. Поддерживаются интерсепторы, тестирование и другие возможности API HttpClient. По умолчанию данные разбираются как JSON. Чтобы иначе обработать ответ, используйте подфункцию httpResource, например httpResource.text().
HttpResourceRef<TResult | undefined>
arrayBuffer
{ <TResult = ArrayBuffer>(url: (ctx: ResourceParamsContext) => string | undefined, options: HttpResourceOptions<TResult, ArrayBuffer> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>; <TResult = ArrayBuffer>(url: (ctx: ResourceParamsContext) => string | undefined, options?: HttpResourceOptions<TResult, ArrayBuffer> | undefined): HttpResourceRef<TResult | undefined>; <TResult = ArrayBuffer>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options: HttpResourceOptions<TResult, ArrayBuffer> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>; <TResult = ArrayBuffer>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options?: HttpResourceOptions<TResult, ArrayBuffer> | undefined): HttpResourceRef<TResult | undefined>; }Создаёт Resource, получающий данные с помощью настроенного HTTP-запроса.
Ресурс будет обновляться при изменении URL или запроса через сигналы.
Для отправки запросов используется HttpClient. Поддерживаются интерсепторы, тестирование и другие возможности API HttpClient. Данные преобразуются в ArrayBuffer.
blob
{ <TResult = Blob>(url: (ctx: ResourceParamsContext) => string | undefined, options: HttpResourceOptions<TResult, Blob> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>; <TResult = Blob>(url: (ctx: ResourceParamsContext) => string | undefined, options?: HttpResourceOptions<TResult, Blob> | undefined): HttpResourceRef<TResult | undefined>; <TResult = Blob>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options: HttpResourceOptions<TResult, Blob> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>; <TResult = Blob>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options?: HttpResourceOptions<TResult, Blob> | undefined): HttpResourceRef<TResult | undefined>; }Создаёт Resource, получающий данные с помощью настроенного HTTP-запроса.
Ресурс будет обновляться при изменении URL или запроса через сигналы.
Для отправки запросов используется HttpClient. Поддерживаются интерсепторы, тестирование и другие возможности API HttpClient. Данные преобразуются в Blob.
text
{ <TResult = string>(url: (ctx: ResourceParamsContext) => string | undefined, options: HttpResourceOptions<TResult, string> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>; <TResult = string>(url: (ctx: ResourceParamsContext) => string | undefined, options?: HttpResourceOptions<TResult, string> | undefined): HttpResourceRef<TResult | undefined>; <TResult = string>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options: HttpResourceOptions<TResult, string> & { defaultValue: NoInfer<TResult>; }): HttpResourceRef<TResult>; <TResult = string>(request: (ctx: ResourceParamsContext) => HttpResourceRequest | undefined, options?: HttpResourceOptions<TResult, string> | undefined): HttpResourceRef<TResult | undefined>; }Создаёт Resource, получающий данные с помощью настроенного HTTP-запроса.
Ресурс будет обновляться при изменении URL или запроса через сигналы.
Для отправки запросов используется HttpClient. Поддерживаются интерсепторы, тестирование и другие возможности API HttpClient. Данные преобразуются в string.
Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/common/http/HttpResourceFn