I have a property on my controller, we'll call it showTheStuff, and my template has an {{#each}} helper in it. For now, I'm just setting the property explicitly.
Within that list, I want to conditionally render or not render some markup depending on the value of showTheStuff, but it doesn't work if I'm using the {{#unless}} conditional.
http://emberjs.jsbin.com/jarapabela/1/
How do I get this to work? In my code, it won't work with {{#unless}}, but if I toggle the property and use {{#if}}, it does work. Has anyone else experienced this?
I'm using Ember 1.6.
controller:
export default Ember.ArrayController.extend({
hideDeleteButton: true,
actions: {
deleteComment: function(comment) {
comment.destroyRecord();
this.removeObject(comment);
}
}
});
template: The template is a modal component rendered within another template. The {{#link-to}} that opens it passes in by passing an array of comments. The property takes effect outside of the {{#each}}, but inside it must be undefined, because even trying to output it in the first cell, nothing shows up when rendered.
<table class="table table-striped table-condensed">
<thead>
<tr>
<th>Comments</th>
{{#unless hideDeleteButton}}
<th></th>
{{/unless}}
</tr>
</thead>
<tbody>
{{#each}}
<tr>
<td>
{{hideDeleteButton}}
<br>
{{comment}}
</td>
<td>
{{createdByResource}}{{hideDeleteButton}}
</td>
{{#unless hideDeleteButton}}
<td class="text-center">
{{confirm-delete-button action="deleteComment" param=this}}
</td>
{{/unless}}
</tr>
{{/each}}
</tbody>
</table>