Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler-cli): avoid handling functions in loadChildren as lazy l…
…oad routes paths The change avoids the compiler CLI internal API from mismatching the following case as lazy loading ``` import { NonLazyLoadedModule } from './non-lazy-loaded/non-lazy-loaded.module'; export function getNonLazyLoadedModule() { return NonLazyLoadedModule; } export const routes = [ { path: '/some-path', loadChildren: getNonLazyLoadedModule } ]; ``` The output of the check is later passed to `RouteDef.fromString()`, so, it makes sense to be only a string. Fixes angular/angular-cli#3204
- Loading branch information
167b1e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Meligy hi :)
I have something similar than that :
![image](https://cloud.githubusercontent.com/assets/4950209/21720645/9c7644c2-d424-11e6-8557-06b9f195f214.png)
But when I use
loadChildren
with an exported function angular-cli tells me :Like in this issue : angular/angular-cli#3204
Except that here I'm not trying to lazy load the module.
Does your fix take the non lazy loaded case into account ? :)
167b1e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It's explicitly for that.
The normal non-lazy-load function is being interpreted as a lazy-loading string. This PR ensures it's checked to be an actual string first. So that if it's a function, it doesn't get treated as a string, and it gets left alone to the router, which knows how to use it already in runtime.
167b1e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I hope it'll be merged soon 😊!!