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