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

feat(router): extend support for lazy loading children #10705

Merged
merged 1 commit into from
Aug 16, 2016

Conversation

vsavkin
Copy link
Contributor

@vsavkin vsavkin commented Aug 11, 2016

Closes #10659

@vsavkin vsavkin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Aug 11, 2016
@robwormald
Copy link
Contributor

LGTM

@robwormald robwormald closed this Aug 11, 2016
@robwormald robwormald reopened this Aug 11, 2016
@vsavkin vsavkin added pr_state: LGTM action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer action: merge The PR is ready for merge by the caretaker labels Aug 11, 2016
@hansl
Copy link
Contributor

hansl commented Aug 11, 2016

LGTM as well.

@sirajc
Copy link

sirajc commented Aug 11, 2016

@brandonroberts This will help in simplification of your AsyncNgModuleLoader, I think

@brandonroberts
Copy link
Contributor

Yep. It actually removes the need for it which is great. Now you can
provide your bundlers method to import through a function that returns a
promise.

On Aug 11, 2016 5:13 PM, "Sirajuddin Choudhary" [email protected]
wrote:

@brandonroberts https://github.com/brandonroberts This will help in
simplification of your AsyncNgModuleLoader, I think


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#10705 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACk4xLnZgDs1YdSft4LOuGpVmASTTWdks5qe56MgaJpZM4JiiAZ
.

@vsavkin vsavkin force-pushed the router_load_children branch 2 times, most recently from be65301 to c2bc40c Compare August 11, 2016 23:03
@vsavkin vsavkin added the action: merge The PR is ready for merge by the caretaker label Aug 11, 2016
@vikerman
Copy link
Contributor

TAP Blocked

@ocombe
Copy link
Contributor

ocombe commented Sep 1, 2016

ohhh does this mean that we can use webpack to generate bundles on its own again with the router ?

@brandonroberts
Copy link
Contributor

@ocombe yep. No longer need a custom loader for webpack support.

@seveves
Copy link

seveves commented Sep 7, 2016

Can I see this in action anywhere?

@ocombe
Copy link
Contributor

ocombe commented Sep 7, 2016

In webpack it's as simple as:

const routerConfig: Routes = [{
  path: '',
  loadChildren: () => System.import('./Home').then(({HomeModule}) => HomeModule)
}]

⚠️ I don't know how this will work with AoT compilation

@seveves
Copy link

seveves commented Sep 7, 2016

@ocombe thank you but now it says "System is not defined" ... do I need to do any changes to my webpack config?

@ocombe
Copy link
Contributor

ocombe commented Sep 7, 2016

Ah my bad, System is only available in webpack 2, if you're using webpack 1 you can do:

const routerConfig: Routes = [{
  path: '',
  loadChildren: () => new Promise(resolve => {
      require.ensure([], require => {
        resolve(require('./Home').HomeModule);
      })
    })
}]

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

router: Add a factoryProvider field to router
9 participants