Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

OrderBy Filter

<!doctype html>
<html>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
  </head>
  <body>
      <h2>FILTER:ORDER BY</h2>
    <div ng-app="myApp" ng-controller="myCtrl">
       <ul>
         <li ng-repeat="x in names | orderBy:'country'">
             {{ x.name + ', ' + x.country }}
         </li>
       </ul>

    </div>
    
    <script>
        angular.module('myApp', []).controller('myCtrl', function($scope)
        {
        $scope.names = [
        {name:'Jani',country:'Norway'},
        {name:'Carl',country:'Sweden'},
        {name:'Margareth',country:'England'},
        {name:'Hege',country:'Norway'},
        {name:'Joe',country:'Denmark'},
        {name:'Gustav',country:'Sweden'},
        {name:'Birgit',country:'Denmark'},
        {name:'Mary',country:'England'},
        {name:'Kai',country:'Norway'}
        ];    
        });
    </script>
  </body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.