1
|
/**
|
2
|
* @license
|
3
|
* Copyright Google Inc. All Rights Reserved.
|
4
|
*
|
5
|
* Use of this source code is governed by an MIT-style license that can be
|
6
|
* found in the LICENSE file at https://angular.io/license
|
7
|
*/
|
8
|
import { InjectionToken } from '@angular/core';
|
9
|
import { LocationChangeListener } from './platform_location';
|
10
|
/**
|
11
|
* `LocationStrategy` is responsible for representing and reading route state
|
12
|
* from the browser's URL. Angular provides two strategies:
|
13
|
* {@link HashLocationStrategy} and {@link PathLocationStrategy}.
|
14
|
*
|
15
|
* This is used under the hood of the {@link Location} service.
|
16
|
*
|
17
|
* Applications should use the {@link Router} or {@link Location} services to
|
18
|
* interact with application route state.
|
19
|
*
|
20
|
* For instance, {@link HashLocationStrategy} produces URLs like
|
21
|
* `http://example.com#/foo`, and {@link PathLocationStrategy} produces
|
22
|
* `http://example.com/foo` as an equivalent URL.
|
23
|
*
|
24
|
* See these two classes for more.
|
25
|
*
|
26
|
* @stable
|
27
|
*/
|
28
|
export declare abstract class LocationStrategy {
|
29
|
abstract path(includeHash?: boolean): string;
|
30
|
abstract prepareExternalUrl(internal: string): string;
|
31
|
abstract pushState(state: any, title: string, url: string, queryParams: string): void;
|
32
|
abstract replaceState(state: any, title: string, url: string, queryParams: string): void;
|
33
|
abstract forward(): void;
|
34
|
abstract back(): void;
|
35
|
abstract onPopState(fn: LocationChangeListener): void;
|
36
|
abstract getBaseHref(): string;
|
37
|
}
|
38
|
/**
|
39
|
* The `APP_BASE_HREF` token represents the base href to be used with the
|
40
|
* {@link PathLocationStrategy}.
|
41
|
*
|
42
|
* If you're using {@link PathLocationStrategy}, you must provide a provider to a string
|
43
|
* representing the URL prefix that should be preserved when generating and recognizing
|
44
|
* URLs.
|
45
|
*
|
46
|
* ### Example
|
47
|
*
|
48
|
* ```typescript
|
49
|
* import {Component, NgModule} from '@angular/core';
|
50
|
* import {APP_BASE_HREF} from '@angular/common';
|
51
|
*
|
52
|
* @NgModule({
|
53
|
* providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
|
54
|
* })
|
55
|
* class AppModule {}
|
56
|
* ```
|
57
|
*
|
58
|
* @stable
|
59
|
*/
|
60
|
export declare const APP_BASE_HREF: InjectionToken<string>;
|