• Overview
@angular/common/http

HttpParams

Class
stable

An HTTP request/response body that represents serialized parameters, per the MIME type application/x-www-form-urlencoded.

API

    
      class HttpParams {  constructor(options?: HttpParamsOptions): HttpParams;  has(param: string): boolean;  get(param: string): string | null;  getAll(param: string): string[] | null;  keys(): string[];  append(param: string, value: string | number | boolean): HttpParams;  appendAll(params: { [param: string]: string | number | boolean | readonly (string | number | boolean)[]; }): HttpParams;  set(param: string, value: string | number | boolean): HttpParams;  delete(param: string, value?: string | number | boolean | undefined): HttpParams;  toString(): string;}
    
    

constructor

HttpParams
@paramoptionsHttpParamsOptions
@returnsHttpParams

has

boolean

Reports whether the body includes one or more values for a given parameter.

@paramparamstring

The parameter name.

@returnsboolean

get

string | null

Retrieves the first value for a parameter.

@paramparamstring

The parameter name.

@returnsstring | null

getAll

string[] | null

Retrieves all values for a parameter.

@paramparamstring

The parameter name.

@returnsstring[] | null

keys

string[]

Retrieves all the parameters for this body.

@returnsstring[]

append

HttpParams

Appends a new value to existing values for a parameter.

@paramparamstring

The parameter name.

@paramvaluestring | number | boolean

The new value to add.

@returnsHttpParams

appendAll

HttpParams

Constructs a new body with appended values for the given parameter name.

@paramparams{ [param: string]: string | number | boolean | readonly (string | number | boolean)[]; }

parameters and values

@returnsHttpParams

set

HttpParams

Replaces the value for a parameter.

@paramparamstring

The parameter name.

@paramvaluestring | number | boolean

The new value.

@returnsHttpParams

delete

HttpParams

Removes a given value or all values from a parameter.

@paramparamstring

The parameter name.

@paramvaluestring | number | boolean | undefined

The value to remove, if provided.

@returnsHttpParams

toString

string

Serializes the body to an encoded string, where key-value pairs (separated by =) are separated by &s.

@returnsstring

Description

An HTTP request/response body that represents serialized parameters, per the MIME type application/x-www-form-urlencoded.

This class is immutable; all mutation operations return a new instance.

Jump to details