Reputation: 7031
I've currently migrated my meteor to 0.8, but i'm having some headache migrating from handlebars to spacebars.
Currently in my javascript function, I retrieve a template and put it inside a leaflet popup.
var marker = new L.Marker(...)
.addTo(map).bindPopup(Template.PopupForm({
data: data
}));
What is the equivalent for this in spacebars ?
Thank you
Upvotes: 0
Views: 130
Reputation: 19544
Template.name
no longer returns just HTML content, it returns a Template object that needs to be rendered and inserted via Meteor's methods. Since you need to pass a ready DOM element to Leaflet's method, you need to create an intermediate div. First you'll render your template to that div, then you can pass it to Leaflet's bindPopup
method.
Code:
var div = document.createElement('div');
UI.insert(UI.renderWithData(Template.PopupForm, {
data: data,
}), div);
L.Marker(...).addTo(map).bindPopup(div);
Upvotes: 2