Created
January 20, 2013 00:53
-
-
Save amboy00/4576081 to your computer and use it in GitHub Desktop.
In Angular.js, push x number of rows into grouped repeaters. Like 7 days in a week, 30 days in a month for example.
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
window.myApp = this.angular.module('myApp', ['ngSanitize']); | |
var monthDays = ['array stuff']; | |
myApp.controller('MyCtrl', function($scope) { | |
var dates = []; | |
for (var i = 0; i < monthDays.length; i++ ) { | |
if (i % 5 == 0) dates.push([]); | |
dates[dates.length-1].push(monthDays[i]); | |
} | |
return $scope.dates = dates; | |
}); | |
<div ng-repeat="days in dates"> | |
<div ng-repeat="day in days"> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment