title: sorting by different attributes using javascript
body: <p>I have the following json from a webservice</p>
  
  <pre><code>    var homes = [
      {
          "h_id": "3",
          "city": "Dallas",
          "state": "TX",
          "zip": "75201",
          "price": "162500",
          "createdOn": "2015-08-31 00:35:14"
      }, {
          "h_id": "4",
          "city": "Bevery Hills",
          "state": "CA",
          "zip": "90210",
          "price": "319250",
          "createdOn": "2015-08-31 14:35:14"
      }, {
          "h_id": "5",
          "city": "New York",
          "state": "NY",
          "zip": "00010",
          "price": "962500",
          "createdOn": "2015-08-31 13:35:14"
      }
  ];
  </code></pre>
  
  <p>Using ng-repeat i am showing this in a div (h_id).I know how to sort by using orderBy. but here i have a html select dropdpwn list.OnClick on that i want to sort by New to Old, Old to new, price and h_id.</p>
  
  <p>How do i create a javascript function to get this type of functionality?</p>