Skip to content

Instantly share code, notes, and snippets.

@Wizek
Forked from anonymous/jsbin.mihevunu.coffee
Created March 28, 2014 21:18
Show Gist options
  • Save Wizek/9843183 to your computer and use it in GitHub Desktop.
Save Wizek/9843183 to your computer and use it in GitHub Desktop.
MainCtrl = ($scope) ->
$scope.list = [4,2,1,11]
$scope.set = {a:1,b:1,c:1}
$scope.fn = (x) -> console.log(x);x
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.4/angular.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body ng-app ng-controller="MainCtrl">
<h3>list</h3>
<div ng-repeat="(k, v) in list | orderBy:'fn'">
{{k}} {{v}}
</div>
<h3>set</h3>
<div ng-repeat="(k, v) in set| orderBy:fn">
{{k}} {{v}}
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment