blob: 53951deb440f132c4e199466d2c7dc4467254a4a (
plain) (
tree)
|
|
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { SortField } from '../shared';
@Component({
selector: 'my-video-sort',
templateUrl: './video-sort.component.html'
})
export class VideoSortComponent {
@Output() sort = new EventEmitter<any>();
@Input() currentSort: SortField;
sortChoices = {
'name': 'Name - Asc',
'-name': 'Name - Desc',
'duration': 'Duration - Asc',
'-duration': 'Duration - Desc',
'createdAt': 'Created Date - Asc',
'-createdAt': 'Created Date - Desc'
};
get choiceKeys() {
return Object.keys(this.sortChoices);
}
getStringChoice(choiceKey: SortField) {
return this.sortChoices[choiceKey];
}
onSortChange() {
this.sort.emit(this.currentSort);
}
}
|