javascript - Handlebars.js #each Not Working -
i'm bashing head against desk on one. cannot understand why isn't working.
i'm trying use simple handlebars #each loop output stars css class defined in model. i'm doing on iphone in uiwebview via trigger.io (not sure if that's relevant or not). not output variable template's html.
i've replicated exact same code js fiddle , works ( http://jsfiddle.net/yeldarb/c4gtc/1/ ) both on computer , on iphone.
after checking , double checking model, decided output variable without looping on , works fine.
the relevant part of template looked this:
{{player_1.stars}} <div class="player_1"> <div class="stars"> {{#each player_1.stars}} <div class="star {{this}}"></div> {{/each}} </div>
which confirmed suspected: handlebars getting data model #each loop somehow failing.
see how outputted starred,starred,starred {{player_1.stars}}? well, resulting html looks this:
craziness tell you. <div class="star "></div>
lines should have been <div class="star starred"></div>
any ideas?
this bug present in earlier version of handlebars has been fixed.
Comments
Post a Comment