meteor add pahans:reactive-modal
mrt add reactive-modal
mrt add bootstrap-3
###Init your bootstrap modal a meteor template is the body of your modal
<template name="appShareDialog">
<p>OK to go ahead and share {{app}}?</p>
</template>
Meteor.startup(function(){
var shareDialogInfo = {
template: Template.appShareDialog,
title: "Share the app",
modalDialogClass: "share-modal-dialog", //optional
modalBodyClass: "share-modal-body", //optional
modalFooterClass: "share-modal-footer",//optional
removeOnHide: true, //optional. If this is true, modal will be removed from DOM upon hiding
buttons: {
"cancel": {
class: 'btn-danger',
label: 'Cancel'
},
"ok": {
closeModalOnClick: false, // if this is false, dialog doesnt close automatically on click
class: 'btn-info',
label: 'Ok'
}
},
doc: { // Provide data context for Template.appShareDialog
app: "My Application"
}
}
var rd = ReactiveModal.initDialog(shareDialogInfo);
});
###button event handling
rd.buttons.ok.on('click', function(button){
// what needs to be done after click ok.
});
###Displaying Modal you can use show/hide methods to show/hide modal
rd.show();
rd.hide();
//modalTarget contains the html
$(rd.modalTarget).find('[name=inputFooBar]').val()
Provide a doc
property on the info options object to provide a data context for your dialog template
MIT