<p>Had do you ever thing on a good way to show / destroy bootstrap modals on meteor in the best way?, if yes here is a little snippet</p>
<pre><code class="language-javascript">//First declare the event handler
Template.myTemplate.events({
'click #myButton': function(event, template){
var dataToTemplate = {
someData: someValue,
someData: someValue
};
Blaze.renderWithData('Template.myModal', dataToTemplate, document.body);
}
});
//Then create the html
<template name="myTemplate">
{{! All the modal html here }}
</template>
//Launch modal.
Template.myTemplate.onRendered(function(){
var tmpl = this;
$(tmpl.firstNode()).modal('show'); //this will trigger the modal when it gets rendered.
});
</code></pre>
<p> </p>
<p>But how to desroyt it?,</p>
<pre><code class="language-javascript">//
Template.myModal.events({
'hidden.bs.modal #myModal':function(event,template){
Blaze.remove(template.view);
}
});
</code></pre>
<p> </p>
<p>Yes.. its this easy.</p>
<p> </p>
<p><a href="http://docs.meteor.com/#/full/blaze_render">Read more about Blaze</a><br>
</p>