]>
Commit | Line | Data |
---|---|---|
1 | import { NgModule } from '@angular/core' | |
2 | import { RouterModule, Routes } from '@angular/router' | |
3 | import { MetaGuard } from '@ngx-meta/core' | |
4 | import { VideoSearchComponent } from './video-list' | |
5 | import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' | |
6 | import { VideoTrendingComponent } from './video-list/video-trending.component' | |
7 | import { VideosComponent } from './videos.component' | |
8 | ||
9 | const videosRoutes: Routes = [ | |
10 | { | |
11 | path: 'videos', | |
12 | component: VideosComponent, | |
13 | canActivateChild: [ MetaGuard ], | |
14 | children: [ | |
15 | { | |
16 | path: 'list', | |
17 | pathMatch: 'full', | |
18 | redirectTo: 'recently-added' | |
19 | }, | |
20 | { | |
21 | path: 'trending', | |
22 | component: VideoTrendingComponent, | |
23 | data: { | |
24 | meta: { | |
25 | title: 'Trending videos' | |
26 | } | |
27 | } | |
28 | }, | |
29 | { | |
30 | path: 'recently-added', | |
31 | component: VideoRecentlyAddedComponent, | |
32 | data: { | |
33 | meta: { | |
34 | title: 'Recently added videos' | |
35 | } | |
36 | } | |
37 | }, | |
38 | { | |
39 | path: 'search', | |
40 | component: VideoSearchComponent, | |
41 | data: { | |
42 | meta: { | |
43 | title: 'Search videos' | |
44 | } | |
45 | } | |
46 | }, | |
47 | { | |
48 | path: 'upload', | |
49 | loadChildren: 'app/videos/+video-edit/video-add.module#VideoAddModule', | |
50 | data: { | |
51 | meta: { | |
52 | title: 'Upload a video' | |
53 | } | |
54 | } | |
55 | }, | |
56 | { | |
57 | path: 'edit/:uuid', | |
58 | loadChildren: 'app/videos/+video-edit/video-update.module#VideoUpdateModule', | |
59 | data: { | |
60 | meta: { | |
61 | title: 'Edit a video' | |
62 | } | |
63 | } | |
64 | }, | |
65 | { | |
66 | path: ':uuid', | |
67 | pathMatch: 'full', | |
68 | redirectTo: 'watch/:uuid' | |
69 | }, | |
70 | { | |
71 | path: 'watch/:uuid', | |
72 | loadChildren: 'app/videos/+video-watch/video-watch.module#VideoWatchModule', | |
73 | data: { | |
74 | preload: 3000 | |
75 | } | |
76 | } | |
77 | ] | |
78 | } | |
79 | ] | |
80 | ||
81 | @NgModule({ | |
82 | imports: [ RouterModule.forChild(videosRoutes) ], | |
83 | exports: [ RouterModule ] | |
84 | }) | |
85 | export class VideosRoutingModule {} |