From 78a8ba23071f593e94d7762a8797713b9d76e5cb Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Tue, 18 Aug 2015 12:29:26 -0700 Subject: [PATCH] refactor(router): move ROUTE_DATA token into own file This change is to accomodate the router in Angular 1.x --- modules/angular2/router.ts | 1 + modules/angular2/src/router/route_config_decorator.ts | 9 +-------- modules/angular2/src/router/route_config_impl.ts | 5 +---- modules/angular2/src/router/route_data.ts | 4 ++++ modules/angular2/src/router/router_outlet.ts | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) create mode 100644 modules/angular2/src/router/route_data.ts diff --git a/modules/angular2/router.ts b/modules/angular2/router.ts index e47435e654..8e938a4b28 100644 --- a/modules/angular2/router.ts +++ b/modules/angular2/router.ts @@ -22,6 +22,7 @@ export {CanActivate} from './src/router/lifecycle_annotations'; export {Instruction, ComponentInstruction} from './src/router/instruction'; export {Url} from './src/router/url_parser'; export {OpaqueToken, Type} from 'angular2/angular2'; +export {ROUTE_DATA} from './src/router/route_data'; import {LocationStrategy} from './src/router/location_strategy'; import {HTML5LocationStrategy} from './src/router/html5_location_strategy'; diff --git a/modules/angular2/src/router/route_config_decorator.ts b/modules/angular2/src/router/route_config_decorator.ts index badeba28c0..ba518e6b7d 100644 --- a/modules/angular2/src/router/route_config_decorator.ts +++ b/modules/angular2/src/router/route_config_decorator.ts @@ -2,13 +2,6 @@ import {RouteConfig as RouteConfigAnnotation, RouteDefinition} from './route_con import {makeDecorator} from 'angular2/src/util/decorators'; import {List} from 'angular2/src/facade/collection'; -export { - Route, - Redirect, - AuxRoute, - AsyncRoute, - RouteDefinition, - ROUTE_DATA -} from './route_config_impl'; +export {Route, Redirect, AuxRoute, AsyncRoute, RouteDefinition} from './route_config_impl'; export var RouteConfig: (configs: List) => ClassDecorator = makeDecorator(RouteConfigAnnotation); diff --git a/modules/angular2/src/router/route_config_impl.ts b/modules/angular2/src/router/route_config_impl.ts index e64d978740..d4d2548b34 100644 --- a/modules/angular2/src/router/route_config_impl.ts +++ b/modules/angular2/src/router/route_config_impl.ts @@ -1,10 +1,7 @@ -import {CONST, CONST_EXPR, Type} from 'angular2/src/facade/lang'; +import {CONST, Type} from 'angular2/src/facade/lang'; import {List} from 'angular2/src/facade/collection'; import {RouteDefinition} from './route_definition'; export {RouteDefinition} from './route_definition'; -import {OpaqueToken} from 'angular2/di'; - -export const ROUTE_DATA: OpaqueToken = CONST_EXPR(new OpaqueToken('routeData')); /** * You use the RouteConfig annotation to add routes to a component. diff --git a/modules/angular2/src/router/route_data.ts b/modules/angular2/src/router/route_data.ts new file mode 100644 index 0000000000..f7cba6aa02 --- /dev/null +++ b/modules/angular2/src/router/route_data.ts @@ -0,0 +1,4 @@ +import {OpaqueToken} from 'angular2/di'; +import {CONST_EXPR} from 'angular2/src/facade/lang'; + +export const ROUTE_DATA: OpaqueToken = CONST_EXPR(new OpaqueToken('routeData')); diff --git a/modules/angular2/src/router/router_outlet.ts b/modules/angular2/src/router/router_outlet.ts index 0fc9af59dd..2fa1772cf1 100644 --- a/modules/angular2/src/router/router_outlet.ts +++ b/modules/angular2/src/router/router_outlet.ts @@ -8,7 +8,7 @@ import {Injector, bind, Dependency, UNDEFINED} from 'angular2/di'; import * as routerMod from './router'; import {Instruction, ComponentInstruction, RouteParams} from './instruction'; -import {ROUTE_DATA} from './route_config_impl'; +import {ROUTE_DATA} from './route_data'; import * as hookMod from './lifecycle_annotations'; import {hasLifecycleHook} from './route_lifecycle_reflector';