AngularJS - How to generate random value for each ng-repeat iteration

前端 未结 3 1888
挽巷
挽巷 2021-02-14 06:35

I am trying to create random span sized divs(.childBox) of twitter bootstrap using AngularJS.

  
3条回答
  •  悲哀的现实
    2021-02-14 07:25

    Just call add getRandomSpan() function to your scope and call it in your template:

    $scope.getRandomSpan = function(){
      return Math.floor((Math.random()*6)+1);
    }
    
    
    

提交回复
热议问题