title: AngularJS Use evaluation of expression in orderBy predicate
body: <p>I have a calculated expression that amounts to a date field in one of my views, and I have a toolbar that allows for sorting.  However, I can't figure out how to sort based on the result of the date expression, not knowing how to link the predicate to the outcome of the expression:</p>
  
  <pre><code>&lt;ul class="dropdown-menu"&gt;
    &lt;li&gt;&lt;a href="" ng-click="predicate = 'postDate.sec * 1000+ postDate.usec'; reverse= false"&gt;Oldest&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="" ng-click="predicate = 'postDate.sec * 1000 + postDate.usec'; reverse= true"&gt;Newest&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="" ng-click="predicate = 'children'; reverse = true"&gt;Most Comments&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="" ng-click="predicate = 'children'; reverse = false"&gt;Least Comments&lt;/a&gt;&lt;/li&gt;
    &lt;li class="divider"&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Mine first&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Then in my DOM</p>
  
  <pre><code>//this is inside an ng-repeat="post in Posts"
  &lt;span &gt;{{ post.postDate.sec*1000 + post.postDate.usec | date:'MMMM d, yyyy' }}&lt;/span &gt;
  </code></pre>
  
  <p>How can my predicate evaluate the entire calculated expression?</p>