HttpParams
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
set(param: string, value: string): HttpParams
delete(param: string, value?: string): HttpParams
toString(): string
}
Description
This class is immutable; all mutation operations return a new instance.
Constructor
constructor(options: HttpParamsOptions = {} as HttpParamsOptions)Parameters
|
Methods
has() | |||
---|---|---|---|
Reports whether the body includes one or more values for a given parameter. | |||
has(param: string): booleanParameters
Returns
|
get() | |||
---|---|---|---|
Retrieves the first value for a parameter. | |||
get(param: string): string | nullParameters
Returns
|
getAll() | |||
---|---|---|---|
Retrieves all values for a parameter. | |||
getAll(param: string): string[] | nullParameters
Returns
|
keys() |
---|
Retrieves all the parameters for this body. |
keys(): string[]ParametersThere are no parameters. Returns
|
append() | ||||||
---|---|---|---|---|---|---|
Appends a new value to existing values for a parameter. | ||||||
append(param: string, value: string): HttpParamsParameters
Returns
|
set() | ||||||
---|---|---|---|---|---|---|
Replaces the value for a parameter. | ||||||
set(param: string, value: string): HttpParamsParameters
Returns
|
delete() | ||||||
---|---|---|---|---|---|---|
Removes a given value or all values from a parameter. | ||||||
delete(param: string, value?: string): HttpParamsParameters
Returns
|
toString() |
---|
Serializes the body to an encoded string, where key-value pairs (separated by = ) are separated by & s.
|
toString(): stringParametersThere are no parameters. Returns
|
© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v10.angular.io/api/common/http/HttpParams