angular-cn/modules/angular2/src/core/application_tokens.ts

26 lines
612 B
TypeScript
Raw Normal View History

2015-05-20 09:48:15 -07:00
import {OpaqueToken} from 'angular2/di';
2015-08-20 14:28:25 -07:00
import {CONST_EXPR} from 'angular2/src/core/facade/lang';
2015-05-20 09:48:15 -07:00
/**
* @private
*/
export const APP_COMPONENT_REF_PROMISE = CONST_EXPR(new OpaqueToken('Promise<ComponentRef>'));
/**
* An opaque token representing the application root type in the {@link Injector}.
*
* ```
* @Component(...)
* @View(...)
* class MyApp {
* ...
* }
*
* bootstrap(MyApp).then((appRef:ApplicationRef) {
* expect(appRef.injector.get(appComponentTypeToken)).toEqual(MyApp);
* });
*
* ```
*/
export const APP_COMPONENT: OpaqueToken = CONST_EXPR(new OpaqueToken('AppComponent'));