diff --git a/modules/@angular/router-deprecated/src/directives/router_link.ts b/modules/@angular/router-deprecated/src/directives/router_link.ts index a86c7fa3a8..9a069b9b57 100644 --- a/modules/@angular/router-deprecated/src/directives/router_link.ts +++ b/modules/@angular/router-deprecated/src/directives/router_link.ts @@ -11,7 +11,7 @@ import {Instruction} from '../instruction'; * ``` * @RouteConfig([ - * { path: '/user', component: UserCmp, as: 'User' } + * { path: '/user', component: UserCmp, name: 'User' } * ]); * class MyComp {} * ``` diff --git a/modules/@angular/router-deprecated/src/route_config/route_config_normalizer.ts b/modules/@angular/router-deprecated/src/route_config/route_config_normalizer.ts index 4e4a593688..f3a24766c4 100644 --- a/modules/@angular/router-deprecated/src/route_config/route_config_normalizer.ts +++ b/modules/@angular/router-deprecated/src/route_config/route_config_normalizer.ts @@ -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({ diff --git a/modules/@angular/router-deprecated/src/route_definition.ts b/modules/@angular/router-deprecated/src/route_definition.ts index cd8388dea9..2b4677aec6 100644 --- a/modules/@angular/router-deprecated/src/route_definition.ts +++ b/modules/@angular/router-deprecated/src/route_definition.ts @@ -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; redirectTo?: any[]; - as?: string; name?: string; data?: any; useAsDefault?: boolean; diff --git a/modules/@angular/router-deprecated/test/route_config/route_config_spec.ts b/modules/@angular/router-deprecated/test/route_config/route_config_spec.ts index f5d6d44894..51b945a8a2 100644 --- a/modules/@angular/router-deprecated/test/route_config/route_config_spec.ts +++ b/modules/@angular/router-deprecated/test/route_config/route_config_spec.ts @@ -177,30 +177,6 @@ export function main() { return null; })})); - it('should throw if a config has an invalid alias name with "as"', - inject( - [AsyncTestCompleter], - (async) => { - bootstrap(BadAliasCmp, testBindings) - .catch((e) => { - expect(e.originalException) - .toContainError( - `Route "/child" with name "child" does not begin with an uppercase letter. Route names should be PascalCase like "Child".`); - async.done(); - return null; - })})); - - it('should throw if a config has multiple alias properties "as" and "name"', - inject([AsyncTestCompleter], - (async) => { - bootstrap(MultipleAliasCmp, testBindings) - .catch((e) => { - expect(e.originalException) - .toContainError( - `Route config should contain exactly one "as" or "name" property.`); - async.done(); - return null; - })})); }); } @@ -309,24 +285,6 @@ class WrongConfigCmp { class BadAliasNameCmp { } -@Component({ - selector: 'app-cmp', - template: `root { }`, - directives: ROUTER_DIRECTIVES -}) -@RouteConfig([{path: '/child', component: HelloCmp, as: 'child'}]) -class BadAliasCmp { -} - -@Component({ - selector: 'app-cmp', - template: `root { }`, - directives: ROUTER_DIRECTIVES -}) -@RouteConfig([{path: '/child', component: HelloCmp, as: 'Child', name: 'Child'}]) -class MultipleAliasCmp { -} - @Component({ selector: 'app-cmp', template: `root { }`,