feat(router): update router to support lazy loading

This commit is contained in:
vsavkin
2016-05-03 16:45:30 -07:00
parent c0cfd3c6ed
commit 0f1465b899
5 changed files with 43 additions and 24 deletions

View File

@ -4,6 +4,7 @@ import {
IS_DART,
Type,
isBlank,
isString
} from '../src/facade/lang';
import {BaseException} from '../src/facade/exceptions';
import {
@ -49,7 +50,12 @@ export class RuntimeCompiler implements ComponentResolver {
private _viewCompiler: ViewCompiler, private _xhr: XHR,
private _genConfig: CompilerConfig) {}
resolveComponent(componentType: Type): Promise<ComponentFactory<any>> {
resolveComponent(component: Type|string): Promise<ComponentFactory<any>> {
if (isString(component)) {
return PromiseWrapper.reject(new BaseException(`Cannot resolve component using '${component}'.`), null);
}
let componentType = <Type>component;
var compMeta: CompileDirectiveMetadata =
this._metadataResolver.getDirectiveMetadata(componentType);
var hostCacheKey = this._hostCacheKeys.get(componentType);