2016-04-28 17:50:03 -07:00
|
|
|
import {Type} from '../src/facade/lang';
|
2016-02-09 11:12:41 -08:00
|
|
|
import {RegexSerializer} from './rules/route_paths/regex_route_path';
|
2015-07-13 16:12:48 -07:00
|
|
|
|
2015-09-21 14:43:24 -07:00
|
|
|
/**
|
|
|
|
|
* `RouteDefinition` defines a route within a {@link RouteConfig} decorator.
|
|
|
|
|
*
|
|
|
|
|
* Supported keys:
|
2015-10-30 17:05:30 -07:00
|
|
|
* - `path` or `aux` (requires exactly one of these)
|
2015-09-21 14:43:24 -07:00
|
|
|
* - `component`, `loader`, `redirectTo` (requires exactly one of these)
|
2016-03-19 20:08:25 +05:30
|
|
|
* - `name` (optional)
|
2015-09-21 14:43:24 -07:00
|
|
|
* - `data` (optional)
|
|
|
|
|
*
|
|
|
|
|
* See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}.
|
|
|
|
|
*/
|
2015-07-13 16:12:48 -07:00
|
|
|
export interface RouteDefinition {
|
2015-10-30 17:05:30 -07:00
|
|
|
path?: string;
|
|
|
|
|
aux?: string;
|
2016-02-09 11:12:41 -08:00
|
|
|
regex?: string;
|
2016-03-21 17:31:42 +01:00
|
|
|
regex_group_names?: string[];
|
2016-02-09 11:12:41 -08:00
|
|
|
serializer?: RegexSerializer;
|
2016-04-12 09:40:37 -07:00
|
|
|
component?: Type | ComponentDefinition;
|
2016-02-19 11:49:31 -08:00
|
|
|
loader?: () => Promise<Type>;
|
2015-11-23 18:07:37 -08:00
|
|
|
redirectTo?: any[];
|
2015-10-25 15:00:27 +05:30
|
|
|
name?: string;
|
2015-08-10 20:29:40 -04:00
|
|
|
data?: any;
|
2015-11-23 18:07:37 -08:00
|
|
|
useAsDefault?: boolean;
|
2015-07-13 16:12:48 -07:00
|
|
|
}
|
|
|
|
|
|
2015-12-03 15:49:09 -08:00
|
|
|
/**
|
|
|
|
|
* Represents either a component type (`type` is `component`) or a loader function
|
|
|
|
|
* (`type` is `loader`).
|
|
|
|
|
*
|
|
|
|
|
* See also {@link RouteDefinition}.
|
|
|
|
|
*/
|
2015-07-13 16:12:48 -07:00
|
|
|
export interface ComponentDefinition {
|
|
|
|
|
type: string;
|
2016-02-19 11:49:31 -08:00
|
|
|
loader?: () => Promise<Type>;
|
2015-07-13 16:12:48 -07:00
|
|
|
component?: Type;
|
|
|
|
|
}
|