Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Another way is to add column number to each team in the $scope.teams.</p> <p><a href="http://jsfiddle.net/dkitchen/y5UzD/4/" rel="nofollow">http://jsfiddle.net/dkitchen/y5UzD/4/</a></p> <p>This splits them into groups of 10...</p> <pre><code>function TeamListController($scope) { $scope.teams = [ { name: "apple", id: 0, isChecked: true, col:1 }, { name: "banana", id: 1, isChecked: false, col:1 }, { name: "mango", id: 2, isChecked: true, col:1 }, { name: "orange", id: 3, isChecked: true, col:1 }, { name: "pear", id: 4, isChecked: false, col:1 }, { name: "john", id: 5, isChecked: true, col:1 }, { name: "paul", id: 6, isChecked: false, col:1 }, { name: "george", id: 7, isChecked: true, col:1 }, { name: "ringo", id: 8, isChecked: true, col:1 }, { name: "roger", id: 9, isChecked: false, col:1 }, { name: "dave", id: 10, isChecked: true, col:2 }, { name: "nick", id: 11, isChecked: false, col:2 } ]; } </code></pre> <p>You can do that at the data source, or you can assign the column number later in the controller.</p> <p>For example, this bit re-groups them into 8 items per column:</p> <pre><code>var colCounter = 1; var colLimit = 8; angular.forEach($scope.teams, function(team){ if((team.id + 1) % (colLimit + 1) == 0) { colCounter++; } team.col = colCounter; }); </code></pre> <p>Then in the view, you can filter each repeater by column number:</p> <pre><code>&lt;div ng-app&gt; &lt;div ng-controller="TeamListController"&gt; &lt;div class="checkboxList"&gt; &lt;div id="teamCheckboxList"&gt; &lt;div ng-repeat="team in teams | filter: { col: 1 }"&gt; &lt;label&gt; &lt;input type="checkbox" ng-model="team.isChecked" /&gt; &lt;span&gt;{{team.name }}&lt;/span&gt; &lt;/label&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div&gt; &lt;div id="teamCheckboxList1"&gt; &lt;div ng-repeat="team in teams | filter: { col: 2 }"&gt; &lt;label&gt; &lt;input type="checkbox" ng-model="team.isChecked" /&gt; &lt;span&gt;{{team.name}}&lt;/span&gt; &lt;/label&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload