Using AngularJS, I\'m iterating over a JSON object containing an array of event objects, containing an array of competition objects.
I wish to show each event
You are using a table but the semantics of your data indicate you have a list of lists. You should consider outputting this with
instead of a grid.
-
{{listing.name}}
-
{{competition.id}} - {{competition.name}}
You can achieve your desired layout with CSS quite easily using the above HTML. Checkout the "block grids" in Twitter Bootstrap or Foundation for examples. Tables should generally be used only for data that is actually tabular.
However...
You're question does still bear answering since there may be other reasons to alternate templates in the way you suggest. You could use a function for this to get things three at a time:
{{listing.name}}
{{competition.id}} - {{competition.name}}
In your controller you can create a "list of lists" to bind to the nested repeaters
// Adapted from Fresheyeball's solution
$scope.competitions = []
compSet = []
for(var i; i < $scope.listings.competitions; i++){
var competition = $scope.listings.competitions[i];
if( i % 3 ){
$scope.competitions.push(compSet);
compSet = [];
}
compSet.push(competition);
}