UNPKG

angular2

Version:

Angular 2 - a web framework for modern web apps

52 lines (51 loc) 1.43 kB
import { LocationStrategy } from './location_strategy'; /** * `HashLocationStrategy` is a {@link LocationStrategy} used to configure the * {@link Location} service to represent its state in the * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) * 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/angular2'; * 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}) * ]); * ``` */ export declare class HashLocationStrategy extends LocationStrategy { private _location; private _history; constructor(); onPopState(fn: EventListener): void; getBaseHref(): string; path(): string; prepareExternalUrl(internal: string): string; pushState(state: any, title: string, path: string, queryParams: string): void; forward(): void; back(): void; }