<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Example - example-orderBy-dynamic</title>
  <link href="style.css" rel="stylesheet" type="text/css">
  

  <script src="../../../angular.min.js"></script>
  <script src="script.js"></script>
  

  
</head>
<body ng-app="orderByExample2">
  <div ng-controller="ExampleController">
  <pre>Sort by = {{propertyName}}; reverse = {{reverse}}</pre>
  <hr/>
  <button ng-click="propertyName = null; reverse = false">Set to unsorted</button>
  <hr/>
  <table class="friends">
    <tr>
      <th>
        <button ng-click="sortBy('name')">Name</button>
        <span class="sortorder" ng-show="propertyName === 'name'" ng-class="{reverse: reverse}"></span>
      </th>
      <th>
        <button ng-click="sortBy('phone')">Phone Number</button>
        <span class="sortorder" ng-show="propertyName === 'phone'" ng-class="{reverse: reverse}"></span>
      </th>
      <th>
        <button ng-click="sortBy('age')">Age</button>
        <span class="sortorder" ng-show="propertyName === 'age'" ng-class="{reverse: reverse}"></span>
      </th>
    </tr>
    <tr ng-repeat="friend in friends | orderBy:propertyName:reverse">
      <td>{{friend.name}}</td>
      <td>{{friend.phone}}</td>
      <td>{{friend.age}}</td>
    </tr>
  </table>
</div>
</body>
</html>