Home
Tutorials
Microsoft Technologies Tutorials
Java Programming Tutorials
Web Designing Tutorials
Script Programming Tutorials
Database Programming Tutorials
Mobile Technologies Tutorials
Other Programming Tutorials
Examples
Articles
Tools
News
AngularJS OrderBy Filter Example
Keywords : Angularjs filter orderby example, Angularjs filter orderby descending / ascending example, Angularjs sort array items example, Angularjs filter orderby desc example
Example
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> AngularJs OrderBy filter Example </title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script> var app = angular.module("AngularOrderByApp", []); app.controller("orderbyctrl", function ($scope) { $scope.users = [{ name: "Madhav Sai", age: 11 }, { name: "Suresh Dasari", age: 29 }, { name: "Rohini Alavala", age: 29 }, { name: "Praveen Kumar", age: 24 }]; }); </script> </head> <body ng-app="AngularOrderByApp"> <h2>AngularJS OrderBy Filter Example</h2> <div ng-controller="orderbyctrl"> <p>OrderBy Name in Ascending Order</p> <ul ng-repeat="user in users | orderBy : 'name'"> <li>{{user.name}}</li> </ul> <p>OrderBy Name in Descending Order</p> <ul ng-repeat="user in users | orderBy : 'name' : true"> <li>{{user.name}}</li> </ul> </div> </body> </html>
Click Here to See Result
Result
Previous
Next