Created
August 29, 2019 17:59
-
-
Save CharlieGreenman/391e382119127b1922c06f1e01ee9511 to your computer and use it in GitHub Desktop.
Pre-loading route data inside of app.routing.module.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from '@angular/core'; | |
import { RouterModule } from '@angular/router'; | |
@NgModule({ | |
imports: [ | |
RouterModule.forRoot( | |
[ | |
{ | |
path: 'books', | |
loadChildren: () => | |
import('@razroo/razroo/books').then( | |
module => module.RazrooBooksModule | |
), | |
data: { preload: true } | |
}, | |
{ | |
path: 'consulting', | |
loadChildren: () => | |
import('@razroo/razroo/consulting').then( | |
module => module.RazrooConsultingModule | |
) | |
}, | |
], | |
{ | |
initialNavigation: 'enabled', | |
relativeLinkResolution: 'corrected' | |
} | |
) | |
], | |
exports: [RouterModule] | |
}) | |
export class RazrooAppRoutingModule {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment