Hi guys, I have succesfully loaded data into a modal in my application and on trying to do it again with another object I am having no success.
The blaze template doesn’t get any data although it is set. Why could this be and how can I better debug it?
My template logic is doing the following:
Template.orderCart.events
'click #confirmOrder': (event) ->
orders = Orders.find({}).fetch()
Session.set 'orders', orders
Modal.show 'confirmOrderEmailModal', orders
Template.confirmOrderEmailModal.helpers
'orders': () ->
orders = Session.get 'order'
return orders
And display is as follows:
<template name="confirmOrderEmailModal">
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Confirm Purchase Order</h4>
</div>
<div class="modal-body">
<p>
<ul class="list-group">
{{#each orders}}
{{> orderItem}}
{{/each}}
</ul>
<button type="button" class="btn btn-success">Confirm Order</button>
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</template>
The {{each orders}} is empty, but in another part of my app where I am using exactly the same method the data is set.
Really cannot figure out why this is. If I console.log orders from the template logic in the coffeescript the data is there. So how can I ensure the modal gets the data context?
Thanks in advance as this bug is all that prevents my app from being finished.
All the best!