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() | |||
|---|---|---|---|
| Check whether the body has one or more values for the given parameter name. | |||
has(param: string): booleanParameters
Returns
|
|
get() | |||
|---|---|---|---|
Get the first value for the given parameter name, or null if it's not present.
| |||
get(param: string): string | nullParameters
Returns
|
|
getAll() | |||
|---|---|---|---|
Get all values for the given parameter name, or null if it's not present.
| |||
getAll(param: string): string[] | nullParameters
Returns
|
|
keys() |
|---|
| Get all the parameter names for this body. |
keys(): string[]ParametersThere are no parameters. Returns
|
|
append() | ||||||
|---|---|---|---|---|---|---|
| Construct a new body with an appended value for the given parameter name. | ||||||
append(param: string, value: string): HttpParamsParameters
Returns
|
|
set() | ||||||
|---|---|---|---|---|---|---|
| Construct a new body with a new value for the given parameter name. | ||||||
set(param: string, value: string): HttpParamsParameters
Returns
|
|
delete() | ||||||
|---|---|---|---|---|---|---|
| Construct a new body with either the given value for the given parameter removed, if a value is given, or all values for the given parameter removed if not. | ||||||
delete(param: string, value?: string): HttpParamsParameters
Returns
|
|
toString() |
|---|
Serialize the body to an encoded string, where key-value pairs (separated by =) are separated by &s.
|
toString(): stringParametersThere are no parameters. Returns
|
© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v7.angular.io/api/common/http/HttpParams