How can one use Meteor Templates w/ the bootboxjs library?
ie, I have the following template
test.html:
<template name="test">
<input type="text" name="testtext"/>
</template>
it has some events,
test.js:
Template.test.events({
'keyup input[name="testtext"]' : function () { console.log('key up in testtext'); }
});
How can you use the template to generate a bootbox modal w/ the events?
mrt add bootboxjs
Spark.render(...)
Example:
bootbox.dialog(
Spark.render(Template.test),
[{
"label" : "Ok",
"class" : "btn-primary",
"callback": function() {}
},{
"label" : "Cancel",
"class" : "btn",
"callback": function() {}
}],
{
"header":"Some Dialog box",
"headerCloseButton":true,
"onEscape": function() {}
}
);
Bonus Example-- Rendering the html, but without any events:
bootbox.dialog(
Template.test({contextVar:'SomeValue'}), // Set your context values here
[{
"label" : "Ok",
"class" : "btn-primary",
"callback": function() {}
},{
"label" : "Cancel",
"class" : "btn",
"callback": function() {}
}],
{
"header":"Some Dialog box",
"headerCloseButton":true,
"onEscape": function() {}
}
);