LocationStrategy
class
npm Package | @angular/common |
---|---|
Module | import { LocationStrategy } from '@angular/common'; |
Source | common/src/location/location_strategy.ts |
Overview
class LocationStrategy { path(includeHash?: boolean): string prepareExternalUrl(internal: string): string pushState(state: any, title: string, url: string, queryParams: string): void replaceState(state: any, title: string, url: string, queryParams: string): void forward(): void back(): void onPopState(fn: LocationChangeListener): void getBaseHref(): string }
Description
LocationStrategy
is responsible for representing and reading route state from the browser's URL. Angular provides two strategies: HashLocationStrategy
and PathLocationStrategy
.
This is used under the hood of the Location
service.
Applications should use the Router
or Location
services to interact with application route state.
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.
Subclasses
-
HashLocationStrategy
-
PathLocationStrategy
-
MockLocationStrategy
Members
path(includeHash?: boolean): string
prepareExternalUrl(internal: string): string
pushState(state: any, title: string, url: string, queryParams: string): void
replaceState(state: any, title: string, url: string, queryParams: string): void
forward(): void
back(): void
onPopState(fn: LocationChangeListener): void
getBaseHref(): string
© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v5.angular.io/api/common/LocationStrategy