Angular Router: Preloading Modules

Using Lazy loading of modules, can make our application load faster.
in order to use lazy loading, we split our application into multiple modules, and those modules will be downloaded from the server and initialized upon demand.
What does it mean “upon demand” – if for example we have a customers module, and a route that navigates to the customers module in our application – only then that module will be downloaded and initialized.

This post, isn’t about how to configure lazy loaded modules, but how we can decide to pre-load certain modules without actually navigating to them. why ? because navigating to a module (customers module in the previous example) , can take some time for the module to be downloaded and initialized. and sometimes we do not want that behavior.

To fix this problem, the angular team have introduced the “loading strategy” option.
we can mark certain modules, to be pre-loaded  while the user is working with the application: not at application initialization, and not while navigating to the module…. but in the background.

please read Victor Savkin’s post with all the details about this feature:

Preloading Modules

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s