1 import { Component, Input, OnInit } from '@angular/core'
2 import { AuthService } from '@app/core'
3 import { VideoSortField } from '@shared/models'
4 import { Video, VideoService } from '../shared-main'
5 import { MiniatureDisplayOptions } from '../shared-video-miniature'
8 * Markup component list videos depending on criterias
12 selector: 'my-videos-list-markup',
13 templateUrl: 'videos-list-markup.component.html',
14 styleUrls: [ 'videos-list-markup.component.scss' ]
16 export class VideosListMarkupComponent implements OnInit {
17 @Input() title: string
18 @Input() description: string
19 @Input() sort = '-publishedAt'
20 @Input() categoryOneOf: number[]
21 @Input() languageOneOf: string[]
26 displayOptions: MiniatureDisplayOptions = {
38 private auth: AuthService,
39 private videoService: VideoService
43 return this.auth.getUser()
50 itemsPerPage: this.count
52 categoryOneOf: this.categoryOneOf,
53 languageOneOf: this.languageOneOf,
54 sort: this.sort as VideoSortField
57 this.videoService.getVideos(options)
58 .subscribe(({ data }) => this.videos = data)