Kątowa 4-kolumna sortująca
Posortowałem kolumny tabeli na podstawie tego przykładu:
Sortowanie kolumn tabeli
https://plnkr.co/edit/nll91Dbc ... eview
To jest potok kodu:
import {Pipe, PipeTransform} from 'angular2/core';@Pipe({ name: 'orderBy' })
export class OrderrByPipe implements PipeTransform { transform(records: Array<any>, args?: any): any { return records.sort(function(a, b){
if(a[args.property] < b[args.property]){
return -1 * args.direction;
}
else if( a[args.property] > b[args.property]){
return 1 * args.direction;
}
else{
return 0;
}
});
};
}
To jest kod HTML:
<tr *ngFor="let particular of particulars | orderBy: {property: column, direction: direction} | slice:1; let i = index">
Importuj w komponencie:
import { OrderrByPipe } from '../pipes/orderby.pipe';
Chcę przenieść rury do Angular 4, jak mogę to zrobić?
Oto błąd w konsoli:
error_handler.js:60 Error: Uncaught (in promise): Error: Error in ./ParticularsListComponent class ParticularsListComponent - inline template:42:14 caused by: Cannot read property 'sort' of undefined
Error: Error in ./ParticularsListComponent class ParticularsListComponent - inline template:42:14 caused by: Cannot read property 'sort' of undefined
Nie znaleziono powiązanych wyników
Zaproszony:
Aby odpowiedzieć na pytania, Zaloguj się lub Zarejestruj się
2 odpowiedzi
Anonimowy użytkownik
Potwierdzenie od:
Anonimowy użytkownik
Potwierdzenie od: