Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save NishiBangar/78e9766901280868bcb115a3122dfd26 to your computer and use it in GitHub Desktop.
Save NishiBangar/78e9766901280868bcb115a3122dfd26 to your computer and use it in GitHub Desktop.
Print array elements in grid format using multiple "ng-repeat"
<html ng-app="myApp">
<body ng-controller="myController">
<div class="row">
<div class="col-sm-3" ng-repeat="remainder in [0,1,2 ]">
<div ng-repeat="item in array" ng-if="$index % 3 == remainder">
{{item}}
</div>
</div>
</div>
</body>
</html>
var myApp=angular.module("myApp",[]);
myApp.controller("myController",['$scope',function($scope){
$scope.array=[1,2,3,4,5,6,7,8,9,10];
}]);
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment