1 import { Component, Input, Output, EventEmitter } from '@angular/core';
3 import { NotificationsService } from 'angular2-notifications';
5 import { SortField, Video, VideoService } from '../shared';
6 import { User } from '../../shared';
9 selector: 'my-video-miniature',
10 styleUrls: [ './video-miniature.component.scss' ],
11 templateUrl: './video-miniature.component.html'
14 export class VideoMiniatureComponent {
15 @Output() removed = new EventEmitter<any>();
17 @Input() currentSort: SortField;
19 @Input() video: Video;
24 private notificationsService: NotificationsService,
25 private videoService: VideoService
29 return this.hovering && this.video.isRemovableBy(this.user);
33 this.hovering = false;
40 removeVideo(id: string) {
41 if (confirm('Do you really want to remove this video?')) {
42 this.videoService.removeVideo(id).subscribe(
43 status => this.removed.emit(true),
45 error => this.notificationsService.error('Error', error.text)