Skip to content

Commit

Permalink
fix(router): improve robustness (#14602)
Browse files Browse the repository at this point in the history
sync a 4.x change from #14155
  • Loading branch information
vicb committed Feb 21, 2017
1 parent 4f93ac8 commit 2a12346
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions modules/@angular/router/src/router_config_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ export class RouterConfigLoader {
if (typeof loadChildren === 'string') {
return fromPromise(this.loader.load(loadChildren));
} else {
const offlineMode = this.compiler instanceof Compiler;
return mergeMap.call(
wrapIntoObservable(loadChildren()),
(t: any) => offlineMode ? of (<any>t) : fromPromise(this.compiler.compileModuleAsync(t)));
return mergeMap.call(wrapIntoObservable(loadChildren()), (t: NgModuleFactory<any>| any) => {
if (t instanceof NgModuleFactory) {
return of (t);
} else {
return fromPromise(this.compiler.compileModuleAsync(t));
}
});
}
}
}

0 comments on commit 2a12346

Please sign in to comment.