My data is arranged in ascending order... and i want it in descending order. I am using angular4. For this i am using a reverse pipe. The code for the same is as below. The first time i used it...it worked ..but later from second time onwards it has started giving error as --> The pipe 'reverse' could not be found.
This is were i referred the code from -
transaction.component.ts
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'reverse',
pure:false
})
export class TransactionComponent implements OnInit ,PipeTransform{
transform (values: any) {
if (values) {
return values.slice().reverse();
}
}
.....//code
}
transaction.component.html
<tr *ngFor="let dat of result |reverse | filter:filterdata|
paginate: { itemsPerPage: 5, currentPage: p };let i = index ">