2016-04-25 21:58:48 -07:00
|
|
|
import {Type, stringify} from "angular2/src/facade/lang";
|
2016-04-22 12:05:18 -07:00
|
|
|
|
|
|
|
|
export abstract class RouteMetadata {
|
|
|
|
|
abstract get path(): string;
|
|
|
|
|
abstract get component(): Type;
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-25 21:58:48 -07:00
|
|
|
/* @ts2dart_const */
|
2016-04-22 12:05:18 -07:00
|
|
|
export class Route implements RouteMetadata {
|
|
|
|
|
path: string;
|
|
|
|
|
component: Type;
|
|
|
|
|
constructor({path, component}: {path?: string, component?: Type} = {}) {
|
|
|
|
|
this.path = path;
|
|
|
|
|
this.component = component;
|
|
|
|
|
}
|
|
|
|
|
toString(): string { return `@Route(${this.path}, ${stringify(this.component)})`; }
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-25 21:58:48 -07:00
|
|
|
/* @ts2dart_const */
|
2016-04-22 12:05:18 -07:00
|
|
|
export class RoutesMetadata {
|
|
|
|
|
constructor(public routes: RouteMetadata[]) {}
|
|
|
|
|
toString(): string { return `@Routes(${this.routes})`; }
|
2016-04-25 21:58:48 -07:00
|
|
|
}
|