fix(router): enable loadChildren with function in aot (#13909)
Closes #11075
This commit is contained in:
parent
2d7b3a86cc
commit
635bf02b02
|
@ -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<any>| Promise<Type<any>>| Observable<Type<any>>;
|
||||
export type LoadChildrenCallback = () =>
|
||||
Type<any>| NgModuleFactory<any>| Promise<Type<any>>| Observable<Type<any>>;
|
||||
|
||||
/**
|
||||
* @whatItDoes The type of `loadChildren`.
|
||||
|
|
|
@ -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<Observable<any>>): Observ
|
|||
return every.call(merged$, (result: any) => result === true);
|
||||
}
|
||||
|
||||
export function wrapIntoObservable<T>(value: T | Promise<T>| Observable<T>): Observable<T> {
|
||||
export function wrapIntoObservable<T>(value: T | NgModuleFactory<T>| Promise<T>| Observable<T>):
|
||||
Observable<T> {
|
||||
if (value instanceof Observable) {
|
||||
return value;
|
||||
}
|
||||
|
@ -136,4 +138,4 @@ export function wrapIntoObservable<T>(value: T | Promise<T>| Observable<T>): Obs
|
|||
}
|
||||
|
||||
return of (value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ export interface ExtraOptions {
|
|||
export declare type LoadChildren = string | LoadChildrenCallback;
|
||||
|
||||
/** @stable */
|
||||
export declare type LoadChildrenCallback = () => Type<any> | Promise<Type<any>> | Observable<Type<any>>;
|
||||
export declare type LoadChildrenCallback = () => Type<any> | NgModuleFactory<any> | Promise<Type<any>> | Observable<Type<any>>;
|
||||
|
||||
/** @stable */
|
||||
export declare class NavigationCancel {
|
||||
|
|
Loading…
Reference in New Issue