Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import { Component, Input, Output, EventEmitter } from '@angular/core';
  2. import { ClubsState, SortState, SortOrder } from '../../store/clubs.state';
  3. import { TableSettings, tableSettings } from './table.settings';
  4.  
  5. @Component({
  6. selector: 'app-table',
  7. templateUrl: './table.component.html',
  8. styleUrls: ['./table.component.scss']
  9. })
  10. export class TableComponent {
  11. @Input() clubs: ClubsState[];
  12. @Input() sortState: SortState;
  13. @Output() doSort = new EventEmitter<SortState>();
  14.  
  15. tableSettings: TableSettings[] = tableSettings;
  16.  
  17. constructor() {}
  18.  
  19. sort(field: string): void {
  20. const order: string =
  21. field === this.sortState.field
  22. ? SortOrder.ASCENDING === this.sortState.order
  23. ? SortOrder.DESCENDING
  24. : SortOrder.ASCENDING
  25. : SortOrder.ASCENDING;
  26.  
  27. this.doSort.emit({ field, order });
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement