LocationStrategy

Stable Class

Class 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
}

Class 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.

Class Details

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

exported from @angular/common/index, defined in @angular/common/src/location/location_strategy.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/common/index/LocationStrategy-class.html