I am forming a Table dynamically using Ember
How can i use nested if while forming the table
Something like this
{{#if ismorethanone && model.hasSize}}
<td> Hai </td>
{{else}}
<td> Bye </td>
{{/if}}
My code
<script type="text/x-handlebars" data-template-name="index">
<table class="table table-striped table-condensed">
<thead>
<tr>
<th>Participant</th>
</tr>
</thead>
<tbody id="ParticipantList">
{{#each person in model}}
<tr>
<td> {{person.name}}</td>
<td> {{person.city}}</td>
{{#if ismorethanone}}
<td><img src="image.jpg" alt="Remove" {{action "removeUser" person.name}}></td>
{{/if}}
</tr>
{{/each}}
</tbody>
</table>
</script>
Either use ember-truth-helpers
:
{{#if (and ismorethanone && model.hasSize)}}
foo
{{else}}
bar
{{/if}
or just nest the if
s:
{{#if foo}}
{{#if bar}}
one
{{else}}
two
{{/if}}
{{/if}}