1 import { Component, EventEmitter, Input, Output } from '@angular/core';
3 import { SortField } from '../shared/index';
6 selector: 'my-video-sort',
7 // styleUrls: [ 'app/angular/videos/components/list/video-sort.component.css' ],
8 templateUrl: 'client/app/videos/video-list/video-sort.component.html'
11 export class VideoSortComponent {
12 @Output() sort = new EventEmitter<any>();
14 @Input() currentSort: SortField;
18 '-name': 'Name - Desc',
19 'duration': 'Duration - Asc',
20 '-duration': 'Duration - Desc',
21 'createdDate': 'Created Date - Asc',
22 '-createdDate': 'Created Date - Desc'
26 return Object.keys(this.sortChoices);
29 getStringChoice(choiceKey: SortField): string {
30 return this.sortChoices[choiceKey];
34 this.sort.emit(this.currentSort);