class
An HTTP request/response body that represents serialized parameters, per the MIME type application/x-www-form-urlencoded.
class HttpParams {
constructor(options: HttpParamsOptions = {} as HttpParamsOptions)
has(param: string): boolean
get(param: string): string | null
getAll(param: string): string[] | null
keys(): string[]
append(param: string, value: string): HttpParams
appendAll(params: { [param: string]: string | string[]; }): HttpParams
set(param: string, value: string): HttpParams
delete(param: string, value?: string): HttpParams
toString(): string
} This class is immutable; all mutation operations return a new instance.
|
options | HttpParamsOptions | Optional. Default is |
| has() | |||
|---|---|---|---|
| Reports whether the body includes one or more values for a given parameter. | |||
|
param | string | The parameter name. |
boolean: True if the parameter has one or more values, false if it has no value or is not present.
| get() | |||
|---|---|---|---|
| Retrieves the first value for a parameter. | |||
|
param | string | The parameter name. |
string | null: The first value of the given parameter, or null if the parameter is not present.
| getAll() | |||
|---|---|---|---|
| Retrieves all values for a parameter. | |||
|
param | string | The parameter name. |
string[] | null: All values in a string array, or null if the parameter not present.
| keys() |
|---|
| Retrieves all the parameters for this body. |
|
| append() | ||||||
|---|---|---|---|---|---|---|
| Appends a new value to existing values for a parameter. | ||||||
|
param | string | The parameter name. |
value | string | The new value to add. |
HttpParams: A new body with the appended value.
| appendAll() | |||
|---|---|---|---|
| Constructs a new body with appended values for the given parameter name. | |||
|
params | object | parameters and values |
HttpParams: A new body with the new value.
| set() | ||||||
|---|---|---|---|---|---|---|
| Replaces the value for a parameter. | ||||||
|
param | string | The parameter name. |
value | string | The new value. |
HttpParams: A new body with the new value.
| delete() | ||||||
|---|---|---|---|---|---|---|
| Removes a given value or all values from a parameter. | ||||||
|
param | string | The parameter name. |
value | string | The value to remove, if provided. Optional. Default is |
HttpParams: A new body with the given value removed, or with all values removed if no value is specified.
| toString() |
|---|
| Serializes the body to an encoded string, where key-value pairs (separated by |
|
© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v11.angular.io/api/common/http/HttpParams