<html>
<head>
<title>Simple app</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.js"></script>
</head>
<body> <div ng-app="myApp">
<input ng-model="name" type="text" placeholder="Your name">
<h1>Hello {{ name }}</h1>
<div ng-controller="CustomScopeController">
{{userSlug}}
</div>
</div><script>
var app = angular.module('myApp', []); function ctrl($scope, $filter) {
$scope.images = [{
orgName: 'B',
sortOrder: 111
}, {
orgName: 'A',
sortOrder: 12
}, {
orgName: 'D',
sortOrder: 13
}, {
orgName: 'C',
sortOrder: 14
}]; $scope.order = function (order) {
if (order == '0') {
$scope.images = $filter('orderBy')($scope.images, 'orgName');
} else {
$scope.images = $filter('orderBy')($scope.images, 'sortOrder');
}
}
}
</script></body></html>