diff --git a/modules/@angular/router/src/config.ts b/modules/@angular/router/src/config.ts index e4c7a78175..dc68e60ced 100644 --- a/modules/@angular/router/src/config.ts +++ b/modules/@angular/router/src/config.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {Type} from '@angular/core'; +import {NgModuleFactory, Type} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {PRIMARY_OUTLET} from './shared'; import {UrlSegment, UrlSegmentGroup} from './url_tree'; @@ -310,7 +310,8 @@ export type ResolveData = { * See {@link Routes} for more details. * @stable */ -export type LoadChildrenCallback = () => Type| Promise>| Observable>; +export type LoadChildrenCallback = () => + Type| NgModuleFactory| Promise>| Observable>; /** * @whatItDoes The type of `loadChildren`. diff --git a/modules/@angular/router/src/utils/collection.ts b/modules/@angular/router/src/utils/collection.ts index 5046aefd71..4bafad0cf4 100644 --- a/modules/@angular/router/src/utils/collection.ts +++ b/modules/@angular/router/src/utils/collection.ts @@ -6,6 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ +import {NgModuleFactory} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {fromPromise} from 'rxjs/observable/fromPromise'; import {of } from 'rxjs/observable/of'; @@ -126,7 +127,8 @@ export function andObservables(observables: Observable>): Observ return every.call(merged$, (result: any) => result === true); } -export function wrapIntoObservable(value: T | Promise| Observable): Observable { +export function wrapIntoObservable(value: T | NgModuleFactory| Promise| Observable): + Observable { if (value instanceof Observable) { return value; } @@ -136,4 +138,4 @@ export function wrapIntoObservable(value: T | Promise| Observable): Obs } return of (value); -} \ No newline at end of file +} diff --git a/tools/public_api_guard/router/index.d.ts b/tools/public_api_guard/router/index.d.ts index 704ceb2c62..680d663e1d 100644 --- a/tools/public_api_guard/router/index.d.ts +++ b/tools/public_api_guard/router/index.d.ts @@ -85,7 +85,7 @@ export interface ExtraOptions { export declare type LoadChildren = string | LoadChildrenCallback; /** @stable */ -export declare type LoadChildrenCallback = () => Type | Promise> | Observable>; +export declare type LoadChildrenCallback = () => Type | NgModuleFactory | Promise> | Observable>; /** @stable */ export declare class NavigationCancel {