Created
April 14, 2016 08:55
-
-
Save KarafiziArtur/a8035c0a1b523adbe607eab7ff9b0a92 to your computer and use it in GitHub Desktop.
Randomize Angular ng-repeat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-controller="MyCtrl"> | |
<p ng-repeat="i in list|orderBy:random">{{i}}</p> | |
</div> | |
function MyCtrl($scope) { | |
$scope.list = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; | |
$scope.random = function() { | |
return 0.5 - Math.random(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment