<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.js"></script>
<div ng-app="sample">
<div ng-controller="peopleController">
<h1>
Sort order
</h1>
<ul>
<li ng-repeat="person in people | orderBy : ['srtName','age']">
{{ person.name}} , {{ person.age}}
</li>
</ul>
</div>
</div>
CSS
body {
font-family: Arial;
}
JavaScript
var app = angular.module('sample', []);
app.controller('peopleController', function($scope) {
$scope.people = [];
function getPeople() {
$scope.people.push({
name: 'C#: How to Program',
srtName: 'C: How to Program',
title: 'STL',
edition:38
});
$scope.people.push({
name: '~Custom: Financial & Managerial Accounting MAL for Tulsa Community College',
srtName: '~Custom: Financial and Managerial Accounting MAL for Tulsa Community College',
title: 'ATL',
age:36
});
$scope.people.push({
name: 'C++ How to Program',
srtName: 'C plus plus How to Program',
title: 'TL',
edition:37
});
$scope.people.push({
name: '¡Arriba! Comunicación y Cultura, Canadian Edition Chapters 7-12',
srtName: '¡Arriba! Comunicación y Cultura, Canadian Edition Chapters 7-12',
title: 'ASE',
edition:68
});
$scope.people.push({
name: 'Dave James Smith',
srtName: 'Dave James Smith',
title: 'ZA',
edition:22
});
$scope.people.push({
name: 'Cid James Smith',
srtName: 'Cid James Smith',
title: 'BQ',
edition:25
});
}
getPeople();
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.