ParamMap

From Get docs
< @angular/routerAngular/docs/9/api/router/parammap


ParamMap

interface

A map that provides access to the required and optional parameters specific to a route. The map supports retrieving a single value with get() or multiple values with getAll().

interface ParamMap {
  keys: string[]
  has(name: string): boolean
  get(name: string): string | null
  getAll(name: string): string[]
}

See also

Properties

Property Description
keys: string[]

Read-Only Names of the parameters in the map.

Methods

Reports whether the map contains a given parameter.

has(name: string): boolean

Parameters
name string The parameter name.
Returns

boolean: True if the map contains the given parameter, false otherwise.


Retrieves a single value for a parameter.

get(name: string): string | null

Parameters
name string The parameter name.
Returns

string | null: The parameter's single value, or the first value if the parameter has multiple values, or null when there is no such parameter.


Retrieves multiple values for a parameter.

getAll(name: string): string[]

Parameters
name string The parameter name.
Returns

string[]: An array containing one or more values, or an empty array if there is no such parameter.



© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v9.angular.io/api/router/ParamMap