|
1 | 1 | import { Routes, RouterModule } from '@angular/router'; |
2 | 2 | import { MetaGuard } from '@ngx-meta/core'; |
3 | 3 |
|
| 4 | +import { WrapperComponent } from '@shared/layouts/wrapper/wrapper.component'; |
| 5 | + |
4 | 6 | const routes: Routes = [ |
| 7 | + { path: '', redirectTo: 'home', pathMatch: 'full' }, |
5 | 8 | { |
6 | | - path: '', loadChildren: './home/home.module#HomeModule', |
7 | | - data: { |
8 | | - // for override default meta |
9 | | - meta: { |
10 | | - title: 'home title', |
11 | | - override: true, |
12 | | - description: 'home description' |
13 | | - } |
14 | | - }, |
15 | | - // need for default meta |
16 | | - canActivateChild: [MetaGuard], |
17 | | - }, |
18 | | - // without meta |
19 | | - { path: 'mock', loadChildren: './mock-server-browser/mock-server-browser.module#MockServerBrowserModule' }, |
20 | | - // with meta |
21 | | - { path: 'back', loadChildren: './transfer-back/transfer-back.module#TransferBackModule', canActivateChild: [MetaGuard]}, |
22 | | - // 404 |
23 | | - { path: '**', loadChildren: './not-found/not-found.module#NotFoundModule' }, |
| 9 | + path: '', component: WrapperComponent, children: [ |
| 10 | + { |
| 11 | + path: 'home', loadChildren: './home/home.module#HomeModule', |
| 12 | + data: { |
| 13 | + // for override default meta |
| 14 | + meta: { |
| 15 | + title: 'home title', |
| 16 | + override: true, |
| 17 | + description: 'home description' |
| 18 | + } |
| 19 | + }, |
| 20 | + // need for default meta |
| 21 | + canActivateChild: [MetaGuard], |
| 22 | + }, |
| 23 | + // without meta |
| 24 | + { path: 'mock', loadChildren: './mock-server-browser/mock-server-browser.module#MockServerBrowserModule' }, |
| 25 | + // with meta |
| 26 | + { path: 'back', loadChildren: './transfer-back/transfer-back.module#TransferBackModule', canActivateChild: [MetaGuard] }, |
| 27 | + // 404 |
| 28 | + { path: '**', loadChildren: './not-found/not-found.module#NotFoundModule' }, |
| 29 | + ] |
| 30 | + } |
24 | 31 | ]; |
25 | 32 | // must use {initialNavigation: 'enabled'}) - for one load page, without reload |
26 | 33 | export const AppRoutes = RouterModule.forRoot(routes, { initialNavigation: 'enabled' }); |
0 commit comments