docs: improve documentation on how to pass a stringified parameter list to HttpClient (#41010)
Fixes #40618 PR Close #41010
This commit is contained in:
parent
9ae0faa00a
commit
ad40fcae7a
@ -74,6 +74,14 @@ function addBody<T>(
|
|||||||
* return this.httpClient.request('GET', this.heroesUrl, {responseType:'json', params});
|
* return this.httpClient.request('GET', this.heroesUrl, {responseType:'json', params});
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
|
*
|
||||||
|
* Alternatively, the parameter string can be used without invoking HttpParams
|
||||||
|
* by directly joining to the URL.
|
||||||
|
* ```
|
||||||
|
* this.httpClient.request('GET', this.heroesUrl + '?' + 'name=term', {responseType:'json'});
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
*
|
||||||
* ### JSONP Example
|
* ### JSONP Example
|
||||||
* ```
|
* ```
|
||||||
* requestJsonp(url, callback = 'callback') {
|
* requestJsonp(url, callback = 'callback') {
|
||||||
@ -92,6 +100,7 @@ function addBody<T>(
|
|||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @see [HTTP Guide](guide/http)
|
* @see [HTTP Guide](guide/http)
|
||||||
|
* @see [HTTP Request](api/common/http/HttpRequest)
|
||||||
*
|
*
|
||||||
* @publicApi
|
* @publicApi
|
||||||
*/
|
*/
|
||||||
|
@ -119,6 +119,13 @@ export class HttpRequest<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Outgoing URL parameters.
|
* Outgoing URL parameters.
|
||||||
|
*
|
||||||
|
* To pass a string representation of HTTP parameters in the URL-query-string format,
|
||||||
|
* the `HttpParamsOptions`' `fromString` may be used. For example:
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* new HttpParams({fromString: 'angular=awesome'})
|
||||||
|
* ```
|
||||||
*/
|
*/
|
||||||
// TODO(issue/24571): remove '!'.
|
// TODO(issue/24571): remove '!'.
|
||||||
readonly params!: HttpParams;
|
readonly params!: HttpParams;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user