angularjs - Random start slide in angular bootstrap carousel -
anyone know of way randomize starting slide in angular version of bootstrap carousel component? slides controller:
$scope.slides = [ {author: "someone", content: "a content..."}, {author: "sometwo", content: "another content"} ... ]; i'm thinking randomize ng-repeat output. dont need everything randomized, starting slide... if best way, fine!
is there way pass random start number carousel directive?
this doesn't have "real" random function... math.random() fine.
got solutions?
solved!
var shufflearray = function(array) { var m = array.length, t, i; // while there remain elements shuffle while (m) { // pick remaining element… = math.floor(math.random() * m--); // , swap current element. t = array[m]; array[m] = array[i]; array[i] = t; } homecoming array; } shufflearray($scope.slides); angularjs
No comments:
Post a Comment