On this page
BrowserPlatformLocation
class final
PlatformLocation encapsulates all of the direct calls to platform APIs. This class should not be used directly by an application developer. Instead, use Location.
class BrowserPlatformLocation extends PlatformLocation {
href: string
protocol: string
hostname: string
port: string
pathname: string
search: string
hash: string
getBaseHrefFromDOM(): string
onPopState(fn: LocationChangeListener): VoidFunction
onHashChange(fn: LocationChangeListener): VoidFunction
pushState(state: any, title: string, url: string): void
replaceState(state: any, title: string, url: string): void
forward(): void
back(): void
historyGo(relativePosition: number = 0): void
getState(): unknown
// inherited from common/PlatformLocation
abstract href: string
abstract protocol: string
abstract hostname: string
abstract port: string
abstract pathname: string
abstract search: string
abstract hash: string
abstract getBaseHrefFromDOM(): string
abstract getState(): unknown
abstract onPopState(fn: LocationChangeListener): VoidFunction
abstract onHashChange(fn: LocationChangeListener): VoidFunction
abstract replaceState(state: any, title: string, url: string): void
abstract pushState(state: any, title: string, url: string): void
abstract forward(): void
abstract back(): void
historyGo(relativePosition: number)?: void
}
Provided in
'platform'
Properties
| Property | Description |
|---|---|
href: string |
Read-Only |
protocol: string |
Read-Only |
hostname: string |
Read-Only |
port: string |
Read-Only |
pathname: string |
|
search: string |
Read-Only |
hash: string |
Read-Only |
Methods
|
getBaseHrefFromDOM()
|
|---|
|
|
onPopState()
|
|||
|---|---|---|---|
|
fn |
LocationChangeListener |
Returns
VoidFunction
|
onHashChange()
|
|||
|---|---|---|---|
|
fn |
LocationChangeListener |
Returns
VoidFunction
|
pushState()
|
|||||||||
|---|---|---|---|---|---|---|---|---|---|
|
state |
any |
|
title |
string |
|
url |
string |
Returns
void
|
replaceState()
|
|||||||||
|---|---|---|---|---|---|---|---|---|---|
|
state |
any |
|
title |
string |
|
url |
string |
Returns
void
|
forward()
|
|---|
|
|
back()
|
|---|
|
|
historyGo()
|
|||
|---|---|---|---|
|
relativePosition |
number |
Optional. Default is |
Returns
void
|
getState()
|
|---|
|
© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/common/BrowserPlatformLocation