W3cubDocs

/Angular 4 TypeScript

ParamMap

Stable Interface

Interface Overview

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

Interface Description

Matrix and Query parameters.

ParamMap makes it easier to work with parameters as they could have either a single value or multiple value. Because this should be known by the user, calling get or getAll returns the correct type (either string or string[]).

The API is inspired by the URLSearchParams interface. see https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams

Interface Details

has(name: string) : boolean
get(name: string) : string|

Return a single value for the given parameter name:

  • the value when the parameter has a single value,
  • the first value if the parameter has multiple values,
  • null when there is no such parameter.
null
getAll(name: string) : string[]

Return an array of values for the given parameter name.

If there is no such parameter, an empty array is returned.

exported from router/index, defined in router/src/shared.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/docs/ts/latest/api/router/index/ParamMap-interface.html