Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can do that without using jQuery.</p> <p><strong>Solution 1:</strong> Ideally, you should use this solution that creates the divs using <code>ng-repeat</code> on descr.proficiency:</p> <pre><code>&lt;div style="width: 274px; height: 19px; float: left; top: 0px; left: 0px; padding-left:10px;"&gt; &lt;div class="count" ng-repeat="n in [] | range:(descr.proficiency)" style="width: 20px;float:left; color:white; top: 0px; height: 7px; border:1px black solid;margin-top:5px;"&gt;.&lt;/div&gt; &lt;/div&gt; </code></pre> <p>JS:</p> <pre><code>app.filter('range', function() { return function(input, total) { total = parseInt(total); for (var i=0; i&lt;total; i++) input.push(i); return input; }; }); </code></pre> <p><strong>Solution 2:</strong> Apply the CSS class conditionally:</p> <pre><code>&lt;div style="width: 274px; height: 19px;float:left; top: 0px; left: 0px; padding-left:10px;"&gt; &lt;div class="{{(descr.proficiency==1 || descr.proficiency==2 || descr.proficiency==3 || descr.proficiency==4 || descr.proficiency==5) &amp;&amp; 'count'}}" id="p0" style="width: 20px;float:left; color:white; top: 0px; height: 7px; border:1px black solid;margin-top:5px;"&gt;.&lt;/div&gt; &lt;div class="{{(descr.proficiency==2 || descr.proficiency==3 || descr.proficiency==4 || descr.proficiency==5) &amp;&amp; 'count'}}" id="p1" style="width: 20px;float:left; color:white; top: 0px; height: 7px; border:1px white solid;margin-top:5px;"&gt;.&lt;/div&gt; &lt;div class="{{(descr.proficiency==3 || descr.proficiency==4 || descr.proficiency==5) &amp;&amp; 'count'}}" id="p2" style="width: 20px;float:left; color:white; top: 0px; height: 7px; border:1px white solid;margin-top:5px;"&gt;.&lt;/div&gt; &lt;div class="{{(descr.proficiency==4 || descr.proficiency==5) &amp;&amp; 'count'}}" id="p3" style="width: 20px;float:left; color:white; top: 0px; height: 7px; border:1px white solid;margin-top:5px;"&gt;.&lt;/div&gt; &lt;div class="{{(descr.proficiency==5) &amp;&amp; 'count'}}" id="p4" style="width: 20px;float:left; color:white; top: 0px; height: 7px; border:1px white solid;margin-top:5px;"&gt;.&lt;/div&gt; &lt;/div&gt; </code></pre>
    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. 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