52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
/** @file
|
|
* @author Edouard DUPIN
|
|
* @copyright 2018, Edouard DUPIN, all right reserved
|
|
* @license PROPRIETARY (see license file)
|
|
*/
|
|
import { Component, OnInit, Input } from '@angular/core';
|
|
import { isNullOrUndefined } from '@kangaroo-and-rabbit/kar-cw';
|
|
import { Series } from 'app/back-api';
|
|
|
|
import { SeriesService, DataService } from 'app/service';
|
|
|
|
@Component({
|
|
selector: 'app-element-series',
|
|
templateUrl: './element-series.html',
|
|
styleUrls: ['./element-series.less']
|
|
})
|
|
export class ElementSeriesComponent implements OnInit {
|
|
// input parameters
|
|
@Input() element: Series;
|
|
|
|
name: string = 'plouf';
|
|
description: string = '';
|
|
countVideo: number = null;
|
|
|
|
covers: string[];
|
|
|
|
constructor(
|
|
private dataService: DataService,
|
|
private seriesService: SeriesService,
|
|
) {
|
|
|
|
}
|
|
ngOnInit() {
|
|
if (isNullOrUndefined(this.element)) {
|
|
this.name = '!!ERROR!!';
|
|
this.description = undefined;
|
|
return;
|
|
}
|
|
let self = this;
|
|
self.name = this.element.name;
|
|
self.description = this.element.description;
|
|
self.covers = self.dataService.getListThumbnailUrl(this.element.covers);
|
|
|
|
this.seriesService.countVideo(this.element.id)
|
|
.then((response) => {
|
|
self.countVideo = response;
|
|
}).catch((response) => {
|
|
self.countVideo = 0;
|
|
});
|
|
}
|
|
}
|