HashLocationStrategy

export class HashLocationStrategy

exported from angular2/router defined in angular2/src/router/hash_location_strategy.ts (line 10)

HashLocationStrategy is a LocationStrategy used to configure the Location service to represent its state in the hash fragment of the browser's URL.

For instance, if you call location.go('/foo'), the browser's URL will become example.com#/foo.

Example

import {Component, provide} from 'angular2/core'; import { ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig, Location, LocationStrategy, HashLocationStrategy } from 'angular2/router'; @Component({directives: [ROUTER_DIRECTIVES]}) @RouteConfig([ {...}, ]) class AppCmp { constructor(location: Location) { location.go('/foo'); } } bootstrap(AppCmp, [ ROUTER_PROVIDERS, provide(LocationStrategy, {useClass: HashLocationStrategy}) ]);

Annotations

@Injectable()

Constructor

constructor(_platformLocation: PlatformLocation, _baseHref?: string)

Not Yet Documented

Members

onPopState(fn: EventListener) : void

Not Yet Documented

getBaseHref() : string

Not Yet Documented

path() : string

Not Yet Documented

prepareExternalUrl(internal: string) : string

Not Yet Documented

pushState(state: any, title: string, path: string, queryParams: string)

Not Yet Documented

replaceState(state: any, title: string, path: string, queryParams: string)

Not Yet Documented

forward() : void

Not Yet Documented

back() : void

Not Yet Documented