title: Unable to sort in reverse using PipeTransform in angular4
body: <p>I am unable to sort the data. I refered from this website -</p>
  
  <p><a href="http://www.advancesharp.com/blog/1211/angular-2-search-and-sort-with-ngfor-repeater-with-example" rel="nofollow noreferrer">http://www.advancesharp.com/blog/1211/angular-2-search-and-sort-with-ngfor-repeater-with-example</a></p>
  
  <p>My data is not getting sorted in descending order -</p>
  
  <p>Code -</p>
  
  <p><strong>transaction.component.ts</strong> file --></p>
  
  <pre><code>import { Pipe, PipeTransform } from '@angular/core';
  @Pipe({ name: 'orderBy' })
  
  export class TransactionComponent implements OnInit,PipeTransform {
  
   isDesc: boolean = false;
   direction;
   column;
  
   sort(property){
   this.direction = this.isDesc ? 1 : -1;
   this.isDesc = !this.isDesc; //change the direction    
   this.column = property;
  
    };
  
   transform(records: Array&lt;any&gt;, args?: any): any {
     return records.sort(function(a, b){
      if(a[args.property] &lt; b[args.property]){
        console.log("clicked on first")
          return -1 *args.direction;
      }
      else if( a[args.property] &gt; b[args.property]){
        console.log("clicked on second")
          return 1 *args.direction;
      }
      else{
        console.log("clicked on third")
          return 0;
      }
    });
    };
    }
  </code></pre>
  
  <p><strong>transaction.component.html</strong> --></p>
  
  <pre><code>&lt;tr *ngfor="let dat of result | filter:filterdata| orderBy : 
  {property: 'LOG_ID',direction:direction } | paginate: { itemsPerPage: 
  5, currentPage: p };let i = index "&gt;
  </code></pre>