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
|
* 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 {Observable} from 'rxjs/Observable';
|
||||||
import {PRIMARY_OUTLET} from './shared';
|
import {PRIMARY_OUTLET} from './shared';
|
||||||
import {UrlSegment, UrlSegmentGroup} from './url_tree';
|
import {UrlSegment, UrlSegmentGroup} from './url_tree';
|
||||||
@ -310,7 +310,8 @@ export type ResolveData = {
|
|||||||
* See {@link Routes} for more details.
|
* See {@link Routes} for more details.
|
||||||
* @stable
|
* @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`.
|
* @whatItDoes The type of `loadChildren`.
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {NgModuleFactory} from '@angular/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
import {fromPromise} from 'rxjs/observable/fromPromise';
|
import {fromPromise} from 'rxjs/observable/fromPromise';
|
||||||
import {of } from 'rxjs/observable/of';
|
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);
|
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) {
|
if (value instanceof Observable) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
2
tools/public_api_guard/router/index.d.ts
vendored
2
tools/public_api_guard/router/index.d.ts
vendored
@ -85,7 +85,7 @@ export interface ExtraOptions {
|
|||||||
export declare type LoadChildren = string | LoadChildrenCallback;
|
export declare type LoadChildren = string | LoadChildrenCallback;
|
||||||
|
|
||||||
/** @stable */
|
/** @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 */
|
/** @stable */
|
||||||
export declare class NavigationCancel {
|
export declare class NavigationCancel {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user