Reputation: 866
I can't understand why this not bind class, when i select box, selectedBox have index with number, i used function indexOf(index) > -1 to return true or false values. Somebody can help me ?
<div class="col" repeat.for="[item] of range(0, 25)">
<label>
<input type="checkbox" model.bind="item" checked.bind="selectedNumbers" class="d-none">
<span class="boxList ${selectedNumbers.indexOf(item) ? 'active': ''}">${item | numberFormat}</span>
</label>
</div>
Upvotes: 0
Views: 42
Reputation: 35222
If I understand correctly, you want to display 24 numbers, and add a class
to the span
when the checkbox is clicked:
I have created a gist:
<div class="col" repeat.for="item of 25">
<label>
<input type="checkbox" model.bind="item" checked.bind="selected" class="d-none">
<span class="boxList ${selected ? 'active': ''}">${item}</span>
</label>
</div>
Upvotes: 1