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 (default).

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

doc_Angular
2016-10-06 09:46:41
Comments
Leave a Comment

Please login to continue.