mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Provide the ability to attach custom data onto a route and retrieve that data as an injectable (RouteData) inside the component. Closes #2777 Closes #3541
13 lines
478 B
TypeScript
13 lines
478 B
TypeScript
import {RouteHandler} from './route_handler';
|
|
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
|
import {Type} from 'angular2/src/facade/lang';
|
|
|
|
export class SyncRouteHandler implements RouteHandler {
|
|
_resolvedComponent: Promise<any> = null;
|
|
|
|
constructor(public componentType: Type, public data?: Object) {
|
|
this._resolvedComponent = PromiseWrapper.resolve(componentType);
|
|
}
|
|
|
|
resolveComponentType(): Promise<any> { return this._resolvedComponent; }
|
|
}
|