1 import { Component, OnInit } from '@angular/core'
2 import { ActivatedRoute } from '@angular/router'
3 import 'rxjs/add/observable/from'
4 import 'rxjs/add/operator/concatAll'
5 import { Account } from '@app/shared/account/account.model'
6 import { AccountService } from '@app/shared/account/account.service'
7 import { VideoChannel } from '../../../../../shared/models/videos'
8 import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
11 selector: 'my-account-video-channels',
12 templateUrl: './account-video-channels.component.html',
13 styleUrls: [ './account-video-channels.component.scss' ]
15 export class AccountVideoChannelsComponent implements OnInit {
17 videoChannels: VideoChannel[] = []
20 protected route: ActivatedRoute,
21 private accountService: AccountService,
22 private videoChannelService: VideoChannelService
26 // Parent get the account for us
27 this.accountService.accountLoaded
28 .do(account => this.account = account)
29 .flatMap(account => this.videoChannelService.getVideoChannels(account.id))
31 .subscribe(videoChannels => this.videoChannels = videoChannels)