1 import { Component, OnInit } from '@angular/core'
2 import { ActivatedRoute } from '@angular/router'
3 import { Account } from '@app/shared/account/account.model'
4 import { AccountService } from '@app/shared/account/account.service'
5 import { VideoChannel } from '../../../../../shared/models/videos'
6 import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
7 import { flatMap, map, tap } from 'rxjs/operators'
10 selector: 'my-account-video-channels',
11 templateUrl: './account-video-channels.component.html',
12 styleUrls: [ './account-video-channels.component.scss' ]
14 export class AccountVideoChannelsComponent implements OnInit {
16 videoChannels: VideoChannel[] = []
19 protected route: ActivatedRoute,
20 private accountService: AccountService,
21 private videoChannelService: VideoChannelService
25 // Parent get the account for us
26 this.accountService.accountLoaded
28 tap(account => this.account = account),
29 flatMap(account => this.videoChannelService.listAccountVideoChannels(account)),
32 .subscribe(videoChannels => this.videoChannels = videoChannels)