title: Angular Custom Order Pipe sorting array correctly
body: <p>I have a custom pipe that orders an array of objects by a prop that is of type number.</p>
  
  <p>Template where pipe is being used</p>
  
  <pre><code>&lt;div *ngFor="let product of products | orderBy:'price'"&gt;
  </code></pre>
  
  <p>OrderByPipe</p>
  
  <pre><code>export class OrderByPipe  implements PipeTransform {
  transform(array: any[], field: string): any[] {
  array.sort((a: any, b: any) =&gt; {
    if (a[field] &lt; b[field]) {
      return -1;
    } else if (a[field] &gt; b[field]) {
      return 1;
    } else {
      return 0;
    }
  });
  return array;
  }
  }
  </code></pre>
  
  <p>The pipe seems to work for smaller arrays and when I use forEach to loop through each item. However when I console the array at the end and when it is returned in the template, the array is still out of order. </p>
  
  <p>I am not entirely sure what might be causing this, thanks.</p>