refactor(router): move assertComponentExists into facade
This is to make way for a refactor to the ng 1.x router directives, which will use strings rather than controller functions in route configs.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import {AsyncRoute, AuxRoute, Route, Redirect, RouteDefinition} from './route_config_decorator';
|
||||
import {ComponentDefinition} from './route_definition';
|
||||
import {Type} from 'angular2/src/core/facade/lang';
|
||||
import {isType, Type} from 'angular2/src/core/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
|
||||
|
||||
@ -47,3 +47,9 @@ export function normalizeRouteConfig(config: RouteDefinition): RouteDefinition {
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
export function assertComponentExists(component: Type, path: string): void {
|
||||
if (!isType(component)) {
|
||||
throw new BaseException(`Component for route "${path}" is not defined, or is not a class.`);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user