File

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

Metadata

selector top-list-display
styleUrls top-list-display.component.css
templateUrl ./top-list-display.component.html

Index

Methods
Inputs
Outputs

Inputs

currentSelectionID

Type: string

topList

Type: Video[]

Outputs

setCurrentVideo $event type: EventEmitter

Methods

selectVideo
selectVideo(id: string)
Parameters :
Name Type Optional
id string no
Returns : void
import { Component, Input, Output, EventEmitter } from '@angular/core';

import { Video } from '../+state/video-stats.interfaces';

@Component({
  selector: 'top-list-display',
  templateUrl: './top-list-display.component.html',
  styleUrls: ['./top-list-display.component.css']
})
export class TopListDisplayComponent {

  @Input() topList: Video[];
  @Input() currentSelectionID: string;
  @Output() setCurrentVideo = new EventEmitter<string>();

  selectVideo(id: string) {
    this.setCurrentVideo.emit(id);
  }
}
<div class="card">
  <div class="card-content">
    <div class="card-title">Top 5 Preview</div>
    <div class="collection">
      <a *ngFor="let video of topList"
         class="collection-item"
         (click)="selectVideo(video.id)"
         [class.active]="currentSelectionID == video.id">
        <div class="card horizontal">
          <div class="card-image">
            <img src="http://img.youtube.com/vi/{{video.id}}/0.jpg">
          </div>
          <div class="card-stacked">
            <div class="card-content">
              <p>{{video.title}}</p>
              <p>{{video.author}}</p>
            </div>
            <div class="card-action">
              <span>{{video.viewDetails.length}}</span>
            </div>
          </div>
        </div>
      </a>
    </div>
  </div>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""