SHARE
TWEET

Untitled

a guest Jul 18th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top