UNPKG

7.14 kBJavaScriptView Raw
1"use strict";
2var __extends = (this && this.__extends) || function (d, b) {
3 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
4 function __() { this.constructor = d; }
5 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6};
7var __make_dart_analyzer_happy = null;
8/**
9 * The `RouteConfig` decorator defines routes for a given component.
10 *
11 * It takes an array of {@link RouteDefinition}s.
12 * @ts2dart_const
13 */
14var RouteConfig = (function () {
15 function RouteConfig(configs) {
16 this.configs = configs;
17 }
18 return RouteConfig;
19}());
20exports.RouteConfig = RouteConfig;
21/* @ts2dart_const */
22var AbstractRoute = (function () {
23 function AbstractRoute(_a) {
24 var name = _a.name, useAsDefault = _a.useAsDefault, path = _a.path, regex = _a.regex, regex_group_names = _a.regex_group_names, serializer = _a.serializer, data = _a.data;
25 this.name = name;
26 this.useAsDefault = useAsDefault;
27 this.path = path;
28 this.regex = regex;
29 this.regex_group_names = regex_group_names;
30 this.serializer = serializer;
31 this.data = data;
32 }
33 return AbstractRoute;
34}());
35exports.AbstractRoute = AbstractRoute;
36/**
37 * `Route` is a type of {@link RouteDefinition} used to route a path to a component.
38 *
39 * It has the following properties:
40 * - `path` is a string that uses the route matcher DSL.
41 * - `component` a component type.
42 * - `name` is an optional `CamelCase` string representing the name of the route.
43 * - `data` is an optional property of any type representing arbitrary route metadata for the given
44 * route. It is injectable via {@link RouteData}.
45 * - `useAsDefault` is a boolean value. If `true`, the child route will be navigated to if no child
46 * route is specified during the navigation.
47 *
48 * ### Example
49 * ```
50 * import {RouteConfig, Route} from '@angular/router-deprecated';
51 *
52 * @RouteConfig([
53 * new Route({path: '/home', component: HomeCmp, name: 'HomeCmp' })
54 * ])
55 * class MyApp {}
56 * ```
57 * @ts2dart_const
58 */
59var Route = (function (_super) {
60 __extends(Route, _super);
61 function Route(_a) {
62 var name = _a.name, useAsDefault = _a.useAsDefault, path = _a.path, regex = _a.regex, regex_group_names = _a.regex_group_names, serializer = _a.serializer, data = _a.data, component = _a.component;
63 _super.call(this, {
64 name: name,
65 useAsDefault: useAsDefault,
66 path: path,
67 regex: regex,
68 regex_group_names: regex_group_names,
69 serializer: serializer,
70 data: data
71 });
72 this.aux = null;
73 this.component = component;
74 }
75 return Route;
76}(AbstractRoute));
77exports.Route = Route;
78/**
79 * `AuxRoute` is a type of {@link RouteDefinition} used to define an auxiliary route.
80 *
81 * It takes an object with the following properties:
82 * - `path` is a string that uses the route matcher DSL.
83 * - `component` a component type.
84 * - `name` is an optional `CamelCase` string representing the name of the route.
85 * - `data` is an optional property of any type representing arbitrary route metadata for the given
86 * route. It is injectable via {@link RouteData}.
87 *
88 * ### Example
89 * ```
90 * import {RouteConfig, AuxRoute} from '@angular/router-deprecated';
91 *
92 * @RouteConfig([
93 * new AuxRoute({path: '/home', component: HomeCmp})
94 * ])
95 * class MyApp {}
96 * ```
97 * @ts2dart_const
98 */
99var AuxRoute = (function (_super) {
100 __extends(AuxRoute, _super);
101 function AuxRoute(_a) {
102 var name = _a.name, useAsDefault = _a.useAsDefault, path = _a.path, regex = _a.regex, regex_group_names = _a.regex_group_names, serializer = _a.serializer, data = _a.data, component = _a.component;
103 _super.call(this, {
104 name: name,
105 useAsDefault: useAsDefault,
106 path: path,
107 regex: regex,
108 regex_group_names: regex_group_names,
109 serializer: serializer,
110 data: data
111 });
112 this.component = component;
113 }
114 return AuxRoute;
115}(AbstractRoute));
116exports.AuxRoute = AuxRoute;
117/**
118 * `AsyncRoute` is a type of {@link RouteDefinition} used to route a path to an asynchronously
119 * loaded component.
120 *
121 * It has the following properties:
122 * - `path` is a string that uses the route matcher DSL.
123 * - `loader` is a function that returns a promise that resolves to a component.
124 * - `name` is an optional `CamelCase` string representing the name of the route.
125 * - `data` is an optional property of any type representing arbitrary route metadata for the given
126 * route. It is injectable via {@link RouteData}.
127 * - `useAsDefault` is a boolean value. If `true`, the child route will be navigated to if no child
128 * route is specified during the navigation.
129 *
130 * ### Example
131 * ```
132 * import {RouteConfig, AsyncRoute} from '@angular/router-deprecated';
133 *
134 * @RouteConfig([
135 * new AsyncRoute({path: '/home', loader: () => Promise.resolve(MyLoadedCmp), name:
136 * 'MyLoadedCmp'})
137 * ])
138 * class MyApp {}
139 * ```
140 * @ts2dart_const
141 */
142var AsyncRoute = (function (_super) {
143 __extends(AsyncRoute, _super);
144 function AsyncRoute(_a) {
145 var name = _a.name, useAsDefault = _a.useAsDefault, path = _a.path, regex = _a.regex, regex_group_names = _a.regex_group_names, serializer = _a.serializer, data = _a.data, loader = _a.loader;
146 _super.call(this, {
147 name: name,
148 useAsDefault: useAsDefault,
149 path: path,
150 regex: regex,
151 regex_group_names: regex_group_names,
152 serializer: serializer,
153 data: data
154 });
155 this.aux = null;
156 this.loader = loader;
157 }
158 return AsyncRoute;
159}(AbstractRoute));
160exports.AsyncRoute = AsyncRoute;
161/**
162 * `Redirect` is a type of {@link RouteDefinition} used to route a path to a canonical route.
163 *
164 * It has the following properties:
165 * - `path` is a string that uses the route matcher DSL.
166 * - `redirectTo` is an array representing the link DSL.
167 *
168 * Note that redirects **do not** affect how links are generated. For that, see the `useAsDefault`
169 * option.
170 *
171 * ### Example
172 * ```
173 * import {RouteConfig, Route, Redirect} from '@angular/router-deprecated';
174 *
175 * @RouteConfig([
176 * new Redirect({path: '/', redirectTo: ['/Home'] }),
177 * new Route({path: '/home', component: HomeCmp, name: 'Home'})
178 * ])
179 * class MyApp {}
180 * ```
181 * @ts2dart_const
182 */
183var Redirect = (function (_super) {
184 __extends(Redirect, _super);
185 function Redirect(_a) {
186 var name = _a.name, useAsDefault = _a.useAsDefault, path = _a.path, regex = _a.regex, regex_group_names = _a.regex_group_names, serializer = _a.serializer, data = _a.data, redirectTo = _a.redirectTo;
187 _super.call(this, {
188 name: name,
189 useAsDefault: useAsDefault,
190 path: path,
191 regex: regex,
192 regex_group_names: regex_group_names,
193 serializer: serializer,
194 data: data
195 });
196 this.redirectTo = redirectTo;
197 }
198 return Redirect;
199}(AbstractRoute));
200exports.Redirect = Redirect;
201//# sourceMappingURL=route_config_impl.js.map
\No newline at end of file