title: ng-class on selected element Angularjs
body: <p>I have a situation where i am sorting data on the basis of expression:</p>
  
  <p>html :</p>
  
  <pre><code> &lt;ul&gt;
    &lt;li ng-click="expression = 'created_at'" ng-class="latest_icon: 'selected'" &gt;latest post&lt;/li&gt;
    &lt;li ng-click="expression = 'popularity'" ng-class="popular_post: 'selected'" &gt;popular post&lt;/li&gt;
   &lt;/ul&gt;
  
  &lt;div ng-repeat = "data in posts | orderBy::expression:true"&gt;
    //showing data
  &lt;/div&gt;
  </code></pre>
  
  <p>So whenever user click on one of the list wheather it is popular or  latest ,selected class will be activated. How could i give expression to ng-class so that  selected class on list get activated. this is without ng-repeat where i can use $index and onselect we can active class. how can i do this here? </p>