Ionic – Angular Lazy Loading Routes

Note Regarding Lazy Loading Routes

If you have Ionic CLI version > 5.2.3 installed. As Ionic 4 is now upgraded to Angular 8. So, Lazy Loading routes work slightly differently.

In the application where ever you’re using loadChildren for lazy loading modules. The newer syntax uses the import statement:

  1. {
  2.     path: ,
  3.     loadChildren: () => import(‘./tabs/tabs.module’).then(m => m.TabsPageModule)
  4.   }

Previous Syntax was like following:

  1. { path: , loadChildren: ‘./tabs/tabs.module#TabsPageModule’ }

The newer syntax will give the autocomplete while typing the module name. Apart from that everything should work fine.

If you’re starting out, you will now get the import syntax automatically and you’ll be good to go.