Last active
August 29, 2015 14:20
-
-
Save timesync/1ba557e380008a0050f1 to your computer and use it in GitHub Desktop.
An example of how to get Bootbox.js and Meteor playing nicely together.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment