Last active
December 13, 2018 13:24
-
-
Save etiennetalbot/52aec70cf514448ba10b23a5a0e87666 to your computer and use it in GitHub Desktop.
Angular Resolver - Routing module example
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, Routes } from '@angular/router'; | |
| import { HashLocationStrategy, LocationStrategy } from '@angular/common'; | |
| import { PilotsListComponent } from './components/pilots-list/pilots-list.component'; | |
| import { PilotsListResolver } from './resolvers/pilots-list.resolver'; | |
| const pilotRoutes: Routes = [ | |
| { | |
| component: PilotsListComponent, | |
| path: 'corporate', | |
| resolve: { pilots: PilotsListResolver }, | |
| }, | |
| ]; | |
| @NgModule({ | |
| exports: [RouterModule], | |
| imports: [RouterModule.forChild(pilotRoutes)], | |
| providers: [{ provide: LocationStrategy, useClass: HashLocationStrategy }], | |
| }) | |
| export class PilotRoutingModule {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment