File

libs/video-stat-dashboard/src/top-list/top-list.component.ts

Metadata

selector top-list
templateUrl ./top-list.component.html

Index

Properties
Methods

Constructor

constructor(topListService: TopListService, dashboardService: DashboardService)
Parameters :
Name Type Optional
topListService TopListService no
dashboardService DashboardService no

Methods

setCurrentVideo
setCurrentVideo(id: )
Parameters :
Name Optional
id no
Returns : void

Properties

currentSelectionID
currentSelectionID: Observable<string>
Type : Observable<string>
topList
topList: Observable<[]>
Type : Observable<[]>
import { Component } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { map } from 'rxjs/operators';

import { TopListService } from '../services/top-list.service';
import { DashboardService } from '../services/dashboard.service';
import { Video } from '../+state/video-stats.interfaces';

@Component({
  selector: 'top-list',
  templateUrl: './top-list.component.html'
})
export class TopListComponent {

  topList: Observable<Video[]>;
  currentSelectionID: Observable<string>;

  constructor(topListService: TopListService, private dashboardService: DashboardService) {
    this.topList = topListService.getTopList();
    this.currentSelectionID = dashboardService.currentVideo
      .pipe(map(video => video && video.id));
  }

  setCurrentVideo(id) {
    this.dashboardService.setCurrentVideo(id);
  }
}
<top-list-display
[topList]="topList | async"
[currentSelectionID]="currentSelectionID | async"
(setCurrentVideo)="setCurrentVideo($event)"
></top-list-display>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""