Created
October 16, 2016 13:17
-
-
Save sasxa/5b6c26499503c40cf41a7eef0db64172 to your computer and use it in GitHub Desktop.
Nested lazy loaded routes
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
export const routes: Routes = [ | |
{ | |
path: '', | |
component: AppComponent, | |
children: [ | |
{ path: 'home', component: DummyComponent }, | |
{ path: '', canLoad: [AuthGuard], loadChildren: './viewer/viewer.module#ViewerModule' }, | |
// { path: '_', canLoad: [AuthGuard], loadChildren: './editor/editor.module#EditorModule' }, | |
{ path: '**', redirectTo: 'home' }, | |
] | |
}, | |
]; | |
@NgModule({ | |
imports: [ | |
RouterModule.forRoot(routes), | |
], | |
exports: [RouterModule], | |
}) | |
export class AppRoutingModule { } |
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
const routes: Routes = [ | |
{ | |
path: '', | |
children: [ | |
{ path: '', component: EditorComponent }, | |
{ path: ':model', component: EditorComponent }, | |
], | |
}, | |
]; | |
@NgModule({ | |
imports: [RouterModule.forChild(routes)], | |
exports: [RouterModule], | |
}) | |
export class EditorRoutingModule { } |
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
@NgModule({ | |
declarations: [ | |
EditorComponent, | |
], | |
imports: [ | |
ReactiveFormsModule, | |
SharedModule, | |
EditorRoutingModule, | |
], | |
providers: [ | |
], | |
}) | |
export class EditorModule { } |
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
const routes: Routes = [ | |
{ | |
path: '', | |
canActivate: [AuthGuard], | |
component: ViewerComponent, | |
children: [ | |
{ path: '_', loadChildren: './editor/editor.module#EditorModule' }, | |
{ path: '', component: DummyComponent }, | |
] | |
}, | |
]; | |
@NgModule({ | |
imports: [RouterModule.forChild(routes)], | |
exports: [RouterModule], | |
}) | |
export class ViewerRoutingModule { } |
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
@NgModule({ | |
declarations: [ | |
ViewerComponent, | |
], | |
imports: [ | |
ViewerRoutingModule, | |
ReactiveFormsModule, | |
SharedModule, | |
], | |
providers: [ ], | |
}) | |
export class ViewerModule { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment