I pull in a JSON object with my controller below, but how do I make the order random, on each page refresh?
app.controller('MainCtrl', ['$scope', '$http', 'makeRandom', function ($scope, $http, makeRandom) {
$http.get('projects/projects.json').success(function(data) {
$scope.works = data;
});
makeRandom.forEach($scope.works, function(work) {
work.rank = Math.random();
});
}]);
template.html
<section ng-repeat="work in works | orderBy:'rank'" class="showcase {{work.class}}">
...
</section>