PlatformLocationlink
This class should not be used directly by an application developer. Instead, use Location
.
说明
PlatformLocation
encapsulates all calls to DOM apis, which allows the Router to be platform agnostic. This means that we can have different implementation of PlatformLocation
for the different platforms that angular supports. For example, @angular/platform-browser
provides an implementation specific to the browser environment, while @angular/platform-webworker
provides one suitable for use with web workers.
The PlatformLocation
class is used directly by all implementations of LocationStrategy
when they need to interact with the DOM apis like pushState, popState, etc...
LocationStrategy
in turn is used by the Location
service which is used directly by the Router
in order to navigate between routes. Since all interactions between Router
/ Location
/ LocationStrategy
and DOM apis flow through the PlatformLocation
class they are all platform independent.
属性
属性名 | 类型 | 说明 |
---|---|---|
pathname | 只读 | |
search | 只读 | |
hash | 只读 |
方法
参数没有参数。 返回值
|
参数
返回值
|
参数
返回值
|
参数
返回值
|
参数
返回值
|
参数没有参数。 返回值
|
参数没有参数。 返回值
|