Skip to content

Instantly share code, notes, and snippets.

@mcallegari10
Last active July 13, 2018 23:58
Show Gist options
  • Save mcallegari10/e9ab6dbc35b02ef74ffc4abb6ed23776 to your computer and use it in GitHub Desktop.
Save mcallegari10/e9ab6dbc35b02ef74ffc4abb6ed23776 to your computer and use it in GitHub Desktop.
import { RouterModule, Routes, PreloadAllModules } from @angular/router;
// You can say to Angular the route is async with the hash at the end of the import
export const ROUTES: Routes = [
{ path: '', pathMatch: 'full', redirectTo: 'dashboard' },
{ path: 'dashboard', loadChildren: '../dashboard/dashboard.module#DashboardModule' },
{ path: 'settings', loadChildren: '../settings/settings.module#SettingsModule' },
{ path: 'reports', loadChildren: '../reports/reports.module#ReportsModule' }
];
@NgModule({
// ...
imports: [
RouteModule.forRoot(ROUTES, { preloadingStrategy: PreloadAllModules })
],
// ...
})
export class AppModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment