1 import { Component, OnInit } from '@angular/core'
2 import { ActivatedRoute } from '@angular/router'
3 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
4 import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
5 import { RestExtractor } from '@app/shared'
6 import { catchError } from 'rxjs/operators'
9 templateUrl: './video-channels.component.html',
10 styleUrls: [ './video-channels.component.scss' ]
12 export class VideoChannelsComponent implements OnInit {
13 videoChannel: VideoChannel
16 private route: ActivatedRoute,
17 private videoChannelService: VideoChannelService,
18 private restExtractor: RestExtractor
22 const videoChannelId = this.route.snapshot.params['videoChannelId']
24 this.videoChannelService.getVideoChannel(videoChannelId)
25 .pipe(catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])))
26 .subscribe(videoChannel => this.videoChannel = videoChannel)