Note that there are some explanatory texts on larger screens.

plurals
  1. POdynamically create two column checkbox list in angular
    primarykey
    data
    text
    <p>I have an application that is using angular.js and I'm very new to it. I have a list of checkboxes that gets dynamically created based on a previous selection. </p> <p>For example, if I have a dropdown of Fruits, the following html will get created:</p> <pre><code>&lt;input type='checkbox' value="apple"&gt;apple&lt;/input&gt; &lt;input type='checkbox' value="banana"&gt;banana&lt;/input&gt; &lt;input type='checkbox' value="mango"&gt;mango&lt;/input&gt; &lt;input type='checkbox' value="orange"&gt;orange&lt;/input&gt; &lt;input type='checkbox' value="pear"&gt;pear&lt;/input&gt; &lt;input type='checkbox' value="watermelon"&gt;water&lt;/input&gt; </code></pre> <p>However, sometimes the amount of checkboxes that get generated gets more than 20 items, and I want to make use of some unused space.</p> <p>So I was wondering if it's possible to split a list of checkboxes into two columns instead of one, so that a new column will generate filling up the rest of the checkboxes?</p> <p>For example: If I have 18 items, instead of one large list of a single column containing 18 checkboxes, the final result will be to have 10 checkboxes in on column, and 8 checkboxes in another column next to it. I want to only have 2 columns as the maximum. Is this possible?</p> <p>Here is what I have so far, I'm not sure if this is the best way of doing it. Otherwise I'll just make an answer for this question and mark it as such. Logic for splitting the data will be done in code-behind I guess.</p> <p>example: <a href="http://jsfiddle.net/7843b/" rel="nofollow">http://jsfiddle.net/7843b/</a></p> <p>Visual representation</p> <pre><code> X Apple X Pears X Banana X Watermelon X Mango X Orange </code></pre> <p>The X represents a checkbox.</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.
 

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