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
How can I conditionally lazy-load a module (without route change)? #13984
Comments
You can load a module by using your own code also. It depends on which loader you are using. For SystemJS you can look at SystemJsNgModuleLoader class. |
@dietergeerts if it's webpack just use Once you have the module use get the You can look at how the router does that |
This isn't a feature request since this functionality already exists on Angular's side. The rest is down to your build tools. |
Just a bit more details:
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a feature request
behavior
I need a way to conditionally lazy-load a module, without a route change.
For example, on a page, the user does an action, then I want to lazy-load a module, which then will insert extra stuff in the main application. This module will be it's own file.
Another example is when the user has been logged in, based on his role, we want to add some extra stuff into our main application services etc....
(I could not find a way to do that now)
What is the motivation / use case for changing the behavior?
If this feature is possible, we won't get ugly conditional code for executing some functions, and we will not need to load the scripts that we don't need. It would be very convenient to do it.
The text was updated successfully, but these errors were encountered: