LocationStrategy
Class
Enables the Location
service to read route state from the browser's URL.
Angular provides two strategies:
HashLocationStrategy
and PathLocationStrategy
.
path
string
@paramincludeHash
boolean | undefined
@returns
string
prepareExternalUrl
string
@paraminternal
string
@returns
string
getState
unknown
@returns
unknown
pushState
void
@paramstate
any
@paramtitle
string
@paramurl
string
@paramqueryParams
string
@returns
void
replaceState
void
@paramstate
any
@paramtitle
string
@paramurl
string
@paramqueryParams
string
@returns
void
forward
void
@returns
void
back
void
@returns
void
historyGo
void
@paramrelativePosition
number
@returns
void
onPopState
void
@returns
void
getBaseHref
string
@returns
string
Description
Enables the Location
service to read route state from the browser's URL.
Angular provides two strategies:
HashLocationStrategy
and PathLocationStrategy
.
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.
Jump to details