Meteor HTML parser give me challenge -
in meteor app, i'm trying list user completed profile on single page. that, need them follow :
<div class="container"> {{#each talker}} {{#if profile.completed}} <div class="row"> <div class="span5 talker-card well"> <span><b>{{profile.username}}</b>, {{profile.location}}</span><br> <b>{{profile.languages.native}}</b> <p> {{profile.bio}} </p> </div> <div class="span5 talker-card well"> <span><b>{{profile.username}}</b>, {{profile.location}}</span><br> <b>{{profile.languages.native}}</b> <p> {{profile.bio}} </p> </div> </div> {{/if}} {{/each}}
two two, must in same row sized span10, split in 2 span5.
the problem must define behavior 3 different cases :
- there profile after one, in same row
- there profile after one, in next row
- there no more profile after one, , there odd number of profile, i'm 1 in row
then, i'd have done in php, solution check boolean isodd, change !isodd @ each iteration, allowing me :
<div class="container"> {{#each talker}} {{#if profile.completed}} {{#if isodd}} <div class="row"> <div class="span5 talker-card well"> <span><b>{{profile.username}}</b>, {{profile.location}}</span><br> <b>{{profile.languages.native}}</b> <p> {{profile.bio}} </p> </div> <div class="span5 talker-card well"> <span><b>{{profile.username}}</b>, {{profile.location}}</span><br> <b>{{profile.languages.native}}</b> <p> {{profile.bio}} </p> </div> {{else}} <div class="span5 talker-card well"> <span><b>{{profile.username}}</b>, {{profile.location}}</span><br> <b>{{profile.languages.native}}</b> <p> {{profile.bio}} </p> </div> <div class="span5 talker-card well"> <span><b>{{profile.username}}</b>, {{profile.location}}</span><br> <b>{{profile.languages.native}}</b> <p> {{profile.bio}} </p> </div> </div> {{/if}} {{/if}} {{/each}} </div>
but can't such simple thing meteor consider error not close div in condition / scope has been opened ! that's stupid point meteor, unless advantages on php : it's strict become hard handle simple cases this.
can 1 give me tips here ?
thanks you
use flexbox or alternative jquery methods if targeting legacy browsers. don't try layout page in application logic. bad idea.
Comments
Post a Comment