30e615b3ed0a9158762cc32db7b3fd2ebd42609b
[oweals/peertube.git] / client / src / app / app-routing.module.ts
1 import { NgModule } from '@angular/core'
2 import { RouterModule, Routes } from '@angular/router'
3
4 import { PreloadSelectedModulesList } from './core'
5 import { AppComponent } from '@app/app.component'
6
7 const routes: Routes = [
8   {
9     path: 'admin',
10     loadChildren: './+admin/admin.module#AdminModule'
11   },
12   {
13     path: 'my-account',
14     loadChildren: './+my-account/my-account.module#MyAccountModule'
15   },
16   {
17     path: 'accounts',
18     loadChildren: './+accounts/accounts.module#AccountsModule'
19   },
20   {
21     path: 'video-channels',
22     loadChildren: './+video-channels/video-channels.module#VideoChannelsModule'
23   },
24   {
25     path: 'about',
26     loadChildren: './+about/about.module#AboutModule'
27   },
28   {
29     path: '',
30     component: AppComponent // Avoid 404, app component will redirect dynamically
31   },
32   {
33     path: '**',
34     loadChildren: './+page-not-found/page-not-found.module#PageNotFoundModule'
35   }
36 ]
37
38 @NgModule({
39   imports: [
40     RouterModule.forRoot(routes, {
41       useHash: Boolean(history.pushState) === false,
42       preloadingStrategy: PreloadSelectedModulesList
43     })
44   ],
45   providers: [
46     PreloadSelectedModulesList
47   ],
48   exports: [ RouterModule ]
49 })
50 export class AppRoutingModule {}