1 import { NgModule } from '@angular/core'
2 import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router'
3 import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
4 import { MenuGuards } from '@app/core/routing/menu-guard.service'
5 import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
6 import { PreloadSelectedModulesList } from './core'
7 import { EmptyComponent } from './empty.component'
9 const routes: Routes = [
12 canActivate: [ MenuGuards.close() ],
13 canDeactivate: [ MenuGuards.open() ],
14 loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule)
18 loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule)
22 loadChildren: () => import('./+my-library/my-library.module').then(m => m.MyLibraryModule)
25 path: 'verify-account',
26 loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule)
30 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule)
33 path: 'video-channels',
34 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule)
38 loadChildren: () => import('./+about/about.module').then(m => m.AboutModule)
42 loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule)
45 path: 'reset-password',
46 loadChildren: () => import('./+reset-password/reset-password.module').then(m => m.ResetPasswordModule)
50 loadChildren: () => import('./+login/login.module').then(m => m.LoginModule)
54 loadChildren: () => import('./+search/search.module').then(m => m.SearchModule)
58 loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule)
61 path: 'remote-interaction',
62 loadChildren: () => import('./+remote-interaction/remote-interaction.module').then(m => m.RemoteInteractionModule)
66 component: EmptyComponent // Avoid 404, app component will redirect dynamically
70 // Avoid 404 when changing language
71 for (const locale of POSSIBLE_LOCALES) {
74 component: EmptyComponent
80 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
85 RouterModule.forRoot(routes, {
86 useHash: Boolean(history.pushState) === false,
87 scrollPositionRestoration: 'disabled',
88 preloadingStrategy: PreloadSelectedModulesList,
89 anchorScrolling: 'disabled'
94 PreloadSelectedModulesList,
95 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
97 exports: [ RouterModule ]
99 export class AppRoutingModule {}