linkLocationStrategy
npm Package | @angular/common |
---|---|
Module | import { LocationStrategy } from '@angular/common'; |
Source | common/src/location/location_strategy.ts |
linkOverview
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
}
linkDescription
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.
linkSubclasses
linkMembers
pushState(state: any, title: string, url: string, queryParams: string): void
replaceState(state: any, title: string, url: string, queryParams: string): void
onPopState(fn: LocationChangeListener): void