Skip to content

Commit

Permalink
feat(router-deprecate): add ROUTER_PRIMARY_COMPONENT opaque token to …
Browse files Browse the repository at this point in the history
…be able to register rootComponent without strings
  • Loading branch information
Hotell committed May 30, 2016
1 parent d73e46c commit 9b9ab44
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/router-deprecated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { RouteDefinition } from './route_definition';
export { ComponentInstruction, RouteData, RouteParams } from './instructions';
export { OnReuse, OnActivate, OnDeactivate, CanDeactivate, CanReuse } from './interfaces';
export { ChildRouter, RootRouter, Router } from './router';
export { ROUTER_PRIMARY_COMPONENT } from './route_registry';
34 changes: 34 additions & 0 deletions src/router-deprecated/route_registry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
import { Injectable } from '../core/di/decorators';
import { RouteDefinition } from './route_definition';
import { Instruction } from './instructions';
import { OpaqueToken } from '../core/di/opaque_token';


/**
* Token used to bind the component with the top-level {@link RouteConfig}s for the
* application.
*
* ### Example ([live demo](http://plnkr.co/edit/iRUP8B5OUbxCWQ3AcIDm))
*
* ```
* import {Component} from '@angular/core';
* import {
* ROUTER_DIRECTIVES,
* ROUTER_PROVIDERS,
* RouteConfig
* } from '@angular/router-deprecated';
*
* @Component({directives: [ROUTER_DIRECTIVES]})
* @RouteConfig([
* {...},
* ])
* class AppCmp {
* // ...
* }
*
* bootstrap(AppCmp, [
* ROUTER_PROVIDERS,
* provide(ROUTER_PRIMARY_COMPONENT, {useValue: AppCmp})
* ])
* ```
*/
// export const ROUTER_PRIMARY_COMPONENT: OpaqueToken = new OpaqueToken('RouterPrimaryComponent');
// angular 1 specific
export const ROUTER_PRIMARY_COMPONENT: OpaqueToken = new OpaqueToken('$routerRootComponent');

/**
* The RouteRegistry holds route configurations for each component in an Angular app.
Expand Down

0 comments on commit 9b9ab44

Please sign in to comment.