LocationStrategy
使 Location 服务能够从浏览器的 URL 读取路由状态。 Angular 提供了两种策略: HashLocationStrategy 和 PathLocationStrategy 。
Enables the Location service to read route state from the browser's URL. Angular provides two strategies: HashLocationStrategy and PathLocationStrategy.
abstract class LocationStrategy {
abstract path(includeHash?: boolean): string
abstract prepareExternalUrl(internal: string): string
abstract pushState(state: any, title: string, url: string, queryParams: string): void
abstract replaceState(state: any, title: string, url: string, queryParams: string): void
abstract forward(): void
abstract back(): void
historyGo(relativePosition: number)?: void
abstract onPopState(fn: LocationChangeListener): void
abstract getBaseHref(): string
}
Provided in
'root'RouterTestingModule
说明
应用程序应使用 Router 或 Location 服务与应用程序的路由状态进行交互。
Applications should use the Router or Location services to interact with application route state.
例如,HashLocationStrategy 会处理像 http://example.com#/foo 这样的 URL,而 PathLocationStrategy 会处理像 http://example.com/foo 这样的等价 URL。
For instance, HashLocationStrategy produces URLs like http://example.com#/foo, and PathLocationStrategy produces http://example.com/foo as an equivalent URL.
有关更多信息,请参见这两个类。
See these two classes for more.
方法
参数没有参数。 返回值
|
参数没有参数。 返回值
|
参数没有参数。 返回值
|