0

I am converting a template (Dashboard like) from JQuery to Angular 2. The website have lot of popups and these popups have many tabs so I put each popup in different component to maintain its code and logic separately. Now if I observe the Network tab in chrome then it can be seen that the major delay is the DOMContentLoaded delay.

So my question is this how to reduce this delay in this kind of situation.

Image of Network tab from Chrome

This page contain just a single signup and forgot form.

Mehmood Ahmad
  • 627
  • 2
  • 5
  • 22
  • build it with AOT https://angular.io/guide/aot-compiler – Anton Lee Sep 06 '17 at 08:20
  • Yes, I provided link for it – Anton Lee Sep 06 '17 at 08:22
  • Can you please tell me how dramatically it can reduce this domLoaded Time? – Mehmood Ahmad Sep 06 '17 at 08:23
  • If you are not going to use those popups straight after page loads you can set up custom preloading strategy. Custom preloading strategy loads defined modules after the initial page load. Similarly there is lazy loading – mxr7350 Sep 06 '17 at 08:24
  • Because, when you use JIT compilation, browser compiles JS code in runtime and DomLoaded time is increasing until compilation complete. In AOT case you already have compiled code and it executes 'immediately'. – Anton Lee Sep 06 '17 at 08:26
  • Thanks for your reply @Anton – Mehmood Ahmad Sep 06 '17 at 08:27
  • Also you can move your popups in different modules and load them lazily as @mxr7350 said – Anton Lee Sep 06 '17 at 08:35
  • I am getting this error in the step of bootstrapping when importing AppModuleNgFactory and using it in bootstrap. any solutions? Argument of type 'NgModuleFactory' is not assignable to parameter of type 'Type<{}>'. – Mehmood Ahmad Sep 06 '17 at 09:50
  • Changes .bootstrapModule() to .bootstrapModuleFactory() solve the above issue – Mehmood Ahmad Sep 06 '17 at 09:59

1 Answers1

0

In my jquery template there are lots of (10) modals which are following Bootstrap modals to make some parts of templates working.

After just deleting them my issue is resolved now the loading time is following

Image of Network Tab in Chrome

Mehmood Ahmad
  • 627
  • 2
  • 5
  • 22