diff options
Diffstat (limited to 'client/src/app/videos')
4 files changed, 21 insertions, 9 deletions
diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts index 8cac2c12c..8f9d50a7b 100644 --- a/client/src/app/videos/video-list/video-local.component.ts +++ b/client/src/app/videos/video-list/video-local.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | 3 | import { immutableAssign } from '@app/shared/misc/utils' |
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { NotificationsService } from 'angular2-notifications' |
@@ -12,7 +12,7 @@ import { VideoService } from '../../shared/video/video.service' | |||
12 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | 12 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], |
13 | templateUrl: '../../shared/video/abstract-video-list.html' | 13 | templateUrl: '../../shared/video/abstract-video-list.html' |
14 | }) | 14 | }) |
15 | export class VideoLocalComponent extends AbstractVideoList implements OnInit { | 15 | export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { |
16 | titlePage = 'Local videos' | 16 | titlePage = 'Local videos' |
17 | currentRoute = '/videos/local' | 17 | currentRoute = '/videos/local' |
18 | sort = '-createdAt' as SortField | 18 | sort = '-createdAt' as SortField |
@@ -29,6 +29,10 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit { | |||
29 | super.ngOnInit() | 29 | super.ngOnInit() |
30 | } | 30 | } |
31 | 31 | ||
32 | ngOnDestroy () { | ||
33 | super.ngOnDestroy() | ||
34 | } | ||
35 | |||
32 | getVideosObservable (page: number) { | 36 | getVideosObservable (page: number) { |
33 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 37 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
34 | 38 | ||
diff --git a/client/src/app/videos/video-list/video-recently-added.component.ts b/client/src/app/videos/video-list/video-recently-added.component.ts index f150e38da..1cecd14a0 100644 --- a/client/src/app/videos/video-list/video-recently-added.component.ts +++ b/client/src/app/videos/video-list/video-recently-added.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | 3 | import { immutableAssign } from '@app/shared/misc/utils' |
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { NotificationsService } from 'angular2-notifications' |
@@ -12,7 +12,7 @@ import { VideoService } from '../../shared/video/video.service' | |||
12 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | 12 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], |
13 | templateUrl: '../../shared/video/abstract-video-list.html' | 13 | templateUrl: '../../shared/video/abstract-video-list.html' |
14 | }) | 14 | }) |
15 | export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit { | 15 | export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy { |
16 | titlePage = 'Recently added' | 16 | titlePage = 'Recently added' |
17 | currentRoute = '/videos/recently-added' | 17 | currentRoute = '/videos/recently-added' |
18 | sort: SortField = '-createdAt' | 18 | sort: SortField = '-createdAt' |
@@ -29,6 +29,10 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On | |||
29 | super.ngOnInit() | 29 | super.ngOnInit() |
30 | } | 30 | } |
31 | 31 | ||
32 | ngOnDestroy () { | ||
33 | super.ngOnDestroy() | ||
34 | } | ||
35 | |||
32 | getVideosObservable (page: number) { | 36 | getVideosObservable (page: number) { |
33 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 37 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
34 | 38 | ||
diff --git a/client/src/app/videos/video-list/video-search.component.ts b/client/src/app/videos/video-list/video-search.component.ts index 241b97bc7..788797a4c 100644 --- a/client/src/app/videos/video-list/video-search.component.ts +++ b/client/src/app/videos/video-list/video-search.component.ts | |||
@@ -47,9 +47,9 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O | |||
47 | } | 47 | } |
48 | 48 | ||
49 | ngOnDestroy () { | 49 | ngOnDestroy () { |
50 | if (this.subActivatedRoute) { | 50 | super.ngOnDestroy() |
51 | this.subActivatedRoute.unsubscribe() | 51 | |
52 | } | 52 | if (this.subActivatedRoute) this.subActivatedRoute.unsubscribe() |
53 | } | 53 | } |
54 | 54 | ||
55 | getVideosObservable (page: number) { | 55 | getVideosObservable (page: number) { |
diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts index a42457273..1dd1ad23b 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | 3 | import { immutableAssign } from '@app/shared/misc/utils' |
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { NotificationsService } from 'angular2-notifications' |
@@ -12,7 +12,7 @@ import { VideoService } from '../../shared/video/video.service' | |||
12 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | 12 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], |
13 | templateUrl: '../../shared/video/abstract-video-list.html' | 13 | templateUrl: '../../shared/video/abstract-video-list.html' |
14 | }) | 14 | }) |
15 | export class VideoTrendingComponent extends AbstractVideoList implements OnInit { | 15 | export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { |
16 | titlePage = 'Trending' | 16 | titlePage = 'Trending' |
17 | currentRoute = '/videos/trending' | 17 | currentRoute = '/videos/trending' |
18 | defaultSort: SortField = '-views' | 18 | defaultSort: SortField = '-views' |
@@ -29,6 +29,10 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit | |||
29 | super.ngOnInit() | 29 | super.ngOnInit() |
30 | } | 30 | } |
31 | 31 | ||
32 | ngOnDestroy () { | ||
33 | super.ngOnDestroy() | ||
34 | } | ||
35 | |||
32 | getVideosObservable (page: number) { | 36 | getVideosObservable (page: number) { |
33 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 37 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
34 | return this.videoService.getVideos(newPagination, this.sort) | 38 | return this.videoService.getVideos(newPagination, this.sort) |