refactor(router): Remove deprecated 'as' from ‘RouteConfig’

BREAKING CHANGE
Remove deprecated 'as' from ‘RouteConfig’ in favour of ‘name’
This commit is contained in:
Vamsi Varikuti
2016-03-19 20:08:25 +05:30
committed by Misko Hevery
parent cbeeff2bd6
commit 49fb7ef421
4 changed files with 3 additions and 51 deletions

View File

@ -11,7 +11,7 @@ import {Instruction} from '../instruction';
* ```
* @RouteConfig([
* { path: '/user', component: UserCmp, as: 'User' }
* { path: '/user', component: UserCmp, name: 'User' }
* ]);
* class MyComp {}
* ```

View File

@ -32,12 +32,7 @@ export function normalizeRouteConfig(config: RouteDefinition,
throw new BaseException(
`Route config should contain exactly one "component", "loader", or "redirectTo" property.`);
}
if (config.as && config.name) {
throw new BaseException(`Route config should contain exactly one "as" or "name" property.`);
}
if (config.as) {
config.name = config.as;
}
if (config.loader) {
var wrappedLoader = wrapLoaderToReconfigureRegistry(config.loader, registry);
return new AsyncRoute({

View File

@ -7,7 +7,7 @@ import {RegexSerializer} from './rules/route_paths/regex_route_path';
* Supported keys:
* - `path` or `aux` (requires exactly one of these)
* - `component`, `loader`, `redirectTo` (requires exactly one of these)
* - `name` or `as` (optional) (requires exactly one of these)
* - `name` (optional)
* - `data` (optional)
*
* See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}.
@ -21,7 +21,6 @@ export interface RouteDefinition {
component?: Type | ComponentDefinition;
loader?: () => Promise<Type>;
redirectTo?: any[];
as?: string;
name?: string;
data?: any;
useAsDefault?: boolean;