ngOnInit () {
this.videoService.getVideos({ currentPage: 1, itemsPerPage: 5 }, '-createdAt')
.subscribe(
- data => this.otherVideos = data.videos,
+ data => {
+ this.otherVideos = data.videos
+ this.updateOtherVideosDisplayed()
+ },
+
err => console.error(err)
)
private onVideoFetched (video: VideoDetails) {
this.video = video
- if (this.otherVideos.length > 0) {
- this.otherVideosDisplayed = this.otherVideos.filter(v => v.uuid !== this.video.uuid)
- }
+ this.updateOtherVideosDisplayed()
let observable
if (this.video.isVideoNSFWForUser(this.user)) {
this.video.dislikes += dislikesToIncrement
}
+ private updateOtherVideosDisplayed () {
+ if (this.otherVideos.length > 0) {
+ this.otherVideosDisplayed = this.otherVideos.filter(v => v.uuid !== this.video.uuid)
+ }
+ }
+
private setOpenGraphTags () {
this.metaService.setTitle(this.video.name)