Skip to content

Please update howto for lazy loading a component #829

Description

@westor21

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

Activity

  1. luchillo17 commented on Aug 25, 2016

    @luchillo17

    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.

  2. paralin commented on Sep 8, 2016

    @paralin

    Did you find any updates on this? See #967

  3. luchillo17 commented on Sep 8, 2016

    @luchillo17

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

  4. paralin commented on Sep 8, 2016

    @paralin

    @Luchillo example?

  5. luchillo17 commented on Sep 8, 2016

    @luchillo17

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

  6. pimenovoleg commented on Sep 20, 2016

    @pimenovoleg

    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"}
    ];
  7. luchillo17 commented on Sep 21, 2016

    @luchillo17

    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.

  8. tungbuivn commented on Jan 5, 2017

    @tungbuivn

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions