13 lines
458 B
TypeScript
13 lines
458 B
TypeScript
import { Pipe, PipeTransform } from '@angular/core';
|
|
import { SortingService } from './sorting.service';
|
|
import { SortingOrder } from './models/sorting-order.type';
|
|
|
|
@Pipe({ name: 'sortBy' })
|
|
export class SortByPipe implements PipeTransform {
|
|
constructor(private readonly _sortingService: SortingService) {}
|
|
|
|
transform<T>(value: T[], order: SortingOrder, column: string): T[] {
|
|
return this._sortingService.sort(value, order, column);
|
|
}
|
|
}
|