UNPKG

4.81 kBTypeScriptView Raw
1import { Type } from '../facade/lang';
2import { RouteDefinition } from '../route_definition';
3import { RegexSerializer } from '../rules/route_paths/regex_route_path';
4export { RouteDefinition } from '../route_definition';
5/**
6 * The `RouteConfig` decorator defines routes for a given component.
7 *
8 * It takes an array of {@link RouteDefinition}s.
9 * @ts2dart_const
10 */
11export declare class RouteConfig {
12 configs: RouteDefinition[];
13 constructor(configs: RouteDefinition[]);
14}
15export declare abstract class AbstractRoute implements RouteDefinition {
16 name: string;
17 useAsDefault: boolean;
18 path: string;
19 regex: string;
20 regex_group_names: string[];
21 serializer: RegexSerializer;
22 data: {
23 [key: string]: any;
24 };
25 constructor({name, useAsDefault, path, regex, regex_group_names, serializer, data}: RouteDefinition);
26}
27/**
28 * `Route` is a type of {@link RouteDefinition} used to route a path to a component.
29 *
30 * It has the following properties:
31 * - `path` is a string that uses the route matcher DSL.
32 * - `component` a component type.
33 * - `name` is an optional `CamelCase` string representing the name of the route.
34 * - `data` is an optional property of any type representing arbitrary route metadata for the given
35 * route. It is injectable via {@link RouteData}.
36 * - `useAsDefault` is a boolean value. If `true`, the child route will be navigated to if no child
37 * route is specified during the navigation.
38 *
39 * ### Example
40 * ```
41 * import {RouteConfig, Route} from '@angular/router-deprecated';
42 *
43 * @RouteConfig([
44 * new Route({path: '/home', component: HomeCmp, name: 'HomeCmp' })
45 * ])
46 * class MyApp {}
47 * ```
48 * @ts2dart_const
49 */
50export declare class Route extends AbstractRoute {
51 component: any;
52 aux: string;
53 constructor({name, useAsDefault, path, regex, regex_group_names, serializer, data, component}: RouteDefinition);
54}
55/**
56 * `AuxRoute` is a type of {@link RouteDefinition} used to define an auxiliary route.
57 *
58 * It takes an object with the following properties:
59 * - `path` is a string that uses the route matcher DSL.
60 * - `component` a component type.
61 * - `name` is an optional `CamelCase` string representing the name of the route.
62 * - `data` is an optional property of any type representing arbitrary route metadata for the given
63 * route. It is injectable via {@link RouteData}.
64 *
65 * ### Example
66 * ```
67 * import {RouteConfig, AuxRoute} from '@angular/router-deprecated';
68 *
69 * @RouteConfig([
70 * new AuxRoute({path: '/home', component: HomeCmp})
71 * ])
72 * class MyApp {}
73 * ```
74 * @ts2dart_const
75 */
76export declare class AuxRoute extends AbstractRoute {
77 component: any;
78 constructor({name, useAsDefault, path, regex, regex_group_names, serializer, data, component}: RouteDefinition);
79}
80/**
81 * `AsyncRoute` is a type of {@link RouteDefinition} used to route a path to an asynchronously
82 * loaded component.
83 *
84 * It has the following properties:
85 * - `path` is a string that uses the route matcher DSL.
86 * - `loader` is a function that returns a promise that resolves to a component.
87 * - `name` is an optional `CamelCase` string representing the name of the route.
88 * - `data` is an optional property of any type representing arbitrary route metadata for the given
89 * route. It is injectable via {@link RouteData}.
90 * - `useAsDefault` is a boolean value. If `true`, the child route will be navigated to if no child
91 * route is specified during the navigation.
92 *
93 * ### Example
94 * ```
95 * import {RouteConfig, AsyncRoute} from '@angular/router-deprecated';
96 *
97 * @RouteConfig([
98 * new AsyncRoute({path: '/home', loader: () => Promise.resolve(MyLoadedCmp), name:
99 * 'MyLoadedCmp'})
100 * ])
101 * class MyApp {}
102 * ```
103 * @ts2dart_const
104 */
105export declare class AsyncRoute extends AbstractRoute {
106 loader: () => Promise<Type>;
107 aux: string;
108 constructor({name, useAsDefault, path, regex, regex_group_names, serializer, data, loader}: RouteDefinition);
109}
110/**
111 * `Redirect` is a type of {@link RouteDefinition} used to route a path to a canonical route.
112 *
113 * It has the following properties:
114 * - `path` is a string that uses the route matcher DSL.
115 * - `redirectTo` is an array representing the link DSL.
116 *
117 * Note that redirects **do not** affect how links are generated. For that, see the `useAsDefault`
118 * option.
119 *
120 * ### Example
121 * ```
122 * import {RouteConfig, Route, Redirect} from '@angular/router-deprecated';
123 *
124 * @RouteConfig([
125 * new Redirect({path: '/', redirectTo: ['/Home'] }),
126 * new Route({path: '/home', component: HomeCmp, name: 'Home'})
127 * ])
128 * class MyApp {}
129 * ```
130 * @ts2dart_const
131 */
132export declare class Redirect extends AbstractRoute {
133 redirectTo: any[];
134 constructor({name, useAsDefault, path, regex, regex_group_names, serializer, data, redirectTo}: RouteDefinition);
135}