diff --git a/packages/common/http/src/client.ts b/packages/common/http/src/client.ts index 3e18131aa3..ee5b434a37 100644 --- a/packages/common/http/src/client.ts +++ b/packages/common/http/src/client.ts @@ -74,6 +74,14 @@ function addBody( * 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 * ``` * requestJsonp(url, callback = 'callback') { @@ -92,6 +100,7 @@ function addBody( * ``` * * @see [HTTP Guide](guide/http) + * @see [HTTP Request](api/common/http/HttpRequest) * * @publicApi */ diff --git a/packages/common/http/src/request.ts b/packages/common/http/src/request.ts index 0467aef812..6f45a5e3e6 100644 --- a/packages/common/http/src/request.ts +++ b/packages/common/http/src/request.ts @@ -119,6 +119,13 @@ export class HttpRequest { /** * 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 '!'. readonly params!: HttpParams;