2016-09-19 16:53:33
, 2016-09-19 16:53:33

Angular2. How to do "lazy loading"?

When writing a mini-application from the official Angular2 tutorial, I noticed that when the page is updated, Angular loads everything at once: all components, services, templates, styles, etc., even those that are not used right now (there is routing). Therefore, the question arose: how to make the so-called "lazy loading" so that what is used here and now is loaded, and, say, when switching to another route, the necessary components, styles, etc. are loaded in it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
bromzh, 2016-09-20
Malcolm @

To do this, you need some kind of module loader, such as SystemJS or Webpack. An example of using webpack is here https://github.com/AngularClass/angular2-webpack-s...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question