Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please update howto for lazy loading a component #829

Closed
westor21 opened this issue Aug 4, 2016 · 10 comments
Closed

Please update howto for lazy loading a component #829

westor21 opened this issue Aug 4, 2016 · 10 comments

Comments

@westor21
Copy link

westor21 commented Aug 4, 2016

I can't bring lazy loading to work. The description here is very poor and should be updated for new router:
https://github.com/AngularClass/angular2-webpack-starter/wiki/How-do-I-async-load-a-component-with-AsyncRoute

Please have a look at my stackoverflow question, would be great to get some hints for the implementation.
http://stackoverflow.com/questions/38736366/how-do-i-async-load-a-component-with-asyncroute-in-webpack

Best regards
westor

@luchillo17
Copy link

Angular 2 is changing a lot, i think they will probably delay it a bit more until an official release, making docs for something that could easily change in a few weeks or months is time consuming.

@paralin
Copy link

paralin commented Sep 8, 2016

Did you find any updates on this? See #967

@luchillo17
Copy link

I actually have Lazy loading working with child pages included, i think with RC.6 is rather easy.

@paralin
Copy link

paralin commented Sep 8, 2016

@Luchillo example?

@qdouble
Copy link

qdouble commented Sep 8, 2016

@luchillo17
Copy link

@paralin Here's mine, just starting a showcase repo but routes are working: https://github.com/Luchillo/Luchillo-tech-showcase

@pimenovoleg
Copy link

Why u dont use https://github.com/Quramy/angular2-load-children-loader ? (for webpack 2)

with es6-promise its look like,

export const appRoutes: Routes = [
  {path: "", component: MainHomeComponent},
  {path: "about", component: MainAboutComponent },
  {path: "sub", loadChildren: "es6-promise!./sub.module#SubModule"}
];

@luchillo17
Copy link

Me? this repo? anyway it's to be more in sync with the future of JS, System.import though not yet available is part of the ES6 specification, thus when it is ready to be used the change should be minimal.

At the end it is roughly the same result, only that the System.import way will be ready for when that feature in the ES6 spec is available everywhere.

@doxiaodong
Copy link

@tungbuivn
Copy link

just modify this code to imports section, replace this:
RouterModule.forRoot(ROUTES, {useHash: false, preloadingStrategy: PreloadAllModules}),
with this:
RouterModule.forRoot(ROUTES, {useHash: false, preloadingStrategy: NoPreloading}),

more information at here:
https://angular.io/docs/ts/latest/guide/router.html#!#custom-preloading-strategy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants