An example of how to get Bootbox.js and Meteor playing nicely together.
bootbox.dialog({
title: “Modal Window Title”,
/**
* Note in the following:
*
* "messages" needs to be a string of at least 1 character in length
* as it's required for Bootbox to function properly.
*/
message: “ “,
buttons:
main: {
label: "Done",
className: "btn-primary",
callback: function() {
console.log(“Done clicked.”);
}
}
},
});
/**
* In order to get reactive templates to function properly, you have to
* render the template after the Bootbox dialog has been instantiated.
*
* Parameters below that might need some explanation:
*
* yourWindowTemplate – The template you want to render inside the Bootbox dialog.
*
* yourDataContext - The data context for the template.
*
* $(".bootbox-body")[0] - This is the parent element where you're rendering your
* content. To get this semi-hack to work, this is REQUIRED.
*/
Blaze.renderWithData(yourWindowTemplate, yourMongoCollection.findOne(item_id), $(".bootbox-body")[0]);