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
|
/**
|
10
|
* Create a {@link UrlResolver} with no package prefix.
|
11
|
*/
|
12
|
export declare function createUrlResolverWithoutPackagePrefix(): UrlResolver;
|
13
|
export declare function createOfflineCompileUrlResolver(): UrlResolver;
|
14
|
/**
|
15
|
* A default provider for {@link PACKAGE_ROOT_URL} that maps to '/'.
|
16
|
*/
|
17
|
export declare const DEFAULT_PACKAGE_URL_PROVIDER: {
|
18
|
provide: InjectionToken<string>;
|
19
|
useValue: string;
|
20
|
};
|
21
|
/**
|
22
|
* Used by the {@link Compiler} when resolving HTML and CSS template URLs.
|
23
|
*
|
24
|
* This class can be overridden by the application developer to create custom behavior.
|
25
|
*
|
26
|
* See {@link Compiler}
|
27
|
*
|
28
|
* ## Example
|
29
|
*
|
30
|
* {@example compiler/ts/url_resolver/url_resolver.ts region='url_resolver'}
|
31
|
*
|
32
|
* @security When compiling templates at runtime, you must
|
33
|
* ensure that the entire template comes from a trusted source.
|
34
|
* Attacker-controlled data introduced by a template could expose your
|
35
|
* application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security).
|
36
|
*/
|
37
|
export declare class UrlResolver {
|
38
|
private _packagePrefix;
|
39
|
constructor(_packagePrefix?: string | null);
|
40
|
/**
|
41
|
* Resolves the `url` given the `baseUrl`:
|
42
|
* - when the `url` is null, the `baseUrl` is returned,
|
43
|
* - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of
|
44
|
* `baseUrl` and `url`,
|
45
|
* - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is
|
46
|
* returned as is (ignoring the `baseUrl`)
|
47
|
*/
|
48
|
resolve(baseUrl: string, url: string): string;
|
49
|
}
|
50
|
/**
|
51
|
* Extract the scheme of a URL.
|
52
|
*/
|
53
|
export declare function getUrlScheme(url: string): string;
|