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