@angular/router-deprecated
Version:
201 lines • 7.14 kB
JavaScript
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __make_dart_analyzer_happy = null;
/**
* The `RouteConfig` decorator defines routes for a given component.
*
* It takes an array of {@link RouteDefinition}s.
* @ts2dart_const
*/
var RouteConfig = (function () {
function RouteConfig(configs) {
this.configs = configs;
}
return RouteConfig;
}());
exports.RouteConfig = RouteConfig;
/* @ts2dart_const */
var AbstractRoute = (function () {
function AbstractRoute(_a) {
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;
this.name = name;
this.useAsDefault = useAsDefault;
this.path = path;
this.regex = regex;
this.regex_group_names = regex_group_names;
this.serializer = serializer;
this.data = data;
}
return AbstractRoute;
}());
exports.AbstractRoute = AbstractRoute;
/**
* `Route` is a type of {@link RouteDefinition} used to route a path to a component.
*
* It has the following properties:
* - `path` is a string that uses the route matcher DSL.
* - `component` a component type.
* - `name` is an optional `CamelCase` string representing the name of the route.
* - `data` is an optional property of any type representing arbitrary route metadata for the given
* route. It is injectable via {@link RouteData}.
* - `useAsDefault` is a boolean value. If `true`, the child route will be navigated to if no child
* route is specified during the navigation.
*
* ### Example
* ```
* import {RouteConfig, Route} from '@angular/router-deprecated';
*
* @RouteConfig([
* new Route({path: '/home', component: HomeCmp, name: 'HomeCmp' })
* ])
* class MyApp {}
* ```
* @ts2dart_const
*/
var Route = (function (_super) {
__extends(Route, _super);
function Route(_a) {
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;
_super.call(this, {
name: name,
useAsDefault: useAsDefault,
path: path,
regex: regex,
regex_group_names: regex_group_names,
serializer: serializer,
data: data
});
this.aux = null;
this.component = component;
}
return Route;
}(AbstractRoute));
exports.Route = Route;
/**
* `AuxRoute` is a type of {@link RouteDefinition} used to define an auxiliary route.
*
* It takes an object with the following properties:
* - `path` is a string that uses the route matcher DSL.
* - `component` a component type.
* - `name` is an optional `CamelCase` string representing the name of the route.
* - `data` is an optional property of any type representing arbitrary route metadata for the given
* route. It is injectable via {@link RouteData}.
*
* ### Example
* ```
* import {RouteConfig, AuxRoute} from '@angular/router-deprecated';
*
* @RouteConfig([
* new AuxRoute({path: '/home', component: HomeCmp})
* ])
* class MyApp {}
* ```
* @ts2dart_const
*/
var AuxRoute = (function (_super) {
__extends(AuxRoute, _super);
function AuxRoute(_a) {
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;
_super.call(this, {
name: name,
useAsDefault: useAsDefault,
path: path,
regex: regex,
regex_group_names: regex_group_names,
serializer: serializer,
data: data
});
this.component = component;
}
return AuxRoute;
}(AbstractRoute));
exports.AuxRoute = AuxRoute;
/**
* `AsyncRoute` is a type of {@link RouteDefinition} used to route a path to an asynchronously
* loaded component.
*
* It has the following properties:
* - `path` is a string that uses the route matcher DSL.
* - `loader` is a function that returns a promise that resolves to a component.
* - `name` is an optional `CamelCase` string representing the name of the route.
* - `data` is an optional property of any type representing arbitrary route metadata for the given
* route. It is injectable via {@link RouteData}.
* - `useAsDefault` is a boolean value. If `true`, the child route will be navigated to if no child
* route is specified during the navigation.
*
* ### Example
* ```
* import {RouteConfig, AsyncRoute} from '@angular/router-deprecated';
*
* @RouteConfig([
* new AsyncRoute({path: '/home', loader: () => Promise.resolve(MyLoadedCmp), name:
* 'MyLoadedCmp'})
* ])
* class MyApp {}
* ```
* @ts2dart_const
*/
var AsyncRoute = (function (_super) {
__extends(AsyncRoute, _super);
function AsyncRoute(_a) {
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;
_super.call(this, {
name: name,
useAsDefault: useAsDefault,
path: path,
regex: regex,
regex_group_names: regex_group_names,
serializer: serializer,
data: data
});
this.aux = null;
this.loader = loader;
}
return AsyncRoute;
}(AbstractRoute));
exports.AsyncRoute = AsyncRoute;
/**
* `Redirect` is a type of {@link RouteDefinition} used to route a path to a canonical route.
*
* It has the following properties:
* - `path` is a string that uses the route matcher DSL.
* - `redirectTo` is an array representing the link DSL.
*
* Note that redirects **do not** affect how links are generated. For that, see the `useAsDefault`
* option.
*
* ### Example
* ```
* import {RouteConfig, Route, Redirect} from '@angular/router-deprecated';
*
* @RouteConfig([
* new Redirect({path: '/', redirectTo: ['/Home'] }),
* new Route({path: '/home', component: HomeCmp, name: 'Home'})
* ])
* class MyApp {}
* ```
* @ts2dart_const
*/
var Redirect = (function (_super) {
__extends(Redirect, _super);
function Redirect(_a) {
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;
_super.call(this, {
name: name,
useAsDefault: useAsDefault,
path: path,
regex: regex,
regex_group_names: regex_group_names,
serializer: serializer,
data: data
});
this.redirectTo = redirectTo;
}
return Redirect;
}(AbstractRoute));
exports.Redirect = Redirect;
//# sourceMappingURL=route_config_impl.js.map