Tuesday, April 15, 2014

Angular js client side sorting

Angular js is providing a very easy way to do client side sorting. Here I am going to explain about a simple client side sorting.

View

 
 
<select ng-model="sortorder1">
 
 <option disabled value="">Choose one</option>
 
 <option value="name">Name</option>     
 
 <option value="age">Age</option>

 </select>        
        
<ul>
 
 <li ng-repeat="datalist in datalists | orderBy:sortorder1">
 
 <div>Name : {{ datalist.name }} Age : {{ datalist.age }}</div> 
 
 </li>

 </ul>

    
 

Here datalist is the json data ( $scope.datalists = data ;)

Demo

Play in fiddle

Related Posts

1. Angular ng-repeate in directive

2. Loop concept in angular js

3. Filtering concept in angular js

4. Show and Hide in angular


No comments :

Post a Comment