Google Maps With Meteor Not Working
For my project i need google maps api. I just can serve the api via script tag, so i tried something like that. my html: app
Template.maps.rendered = function() {
var mapOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
}
It really depends more on what your template looks like. The rendered callback will re run everytime the template changes reactively too. So if you find it re-renders you might have to use a Session
hash to check it only sets the maps center/settings only once.
Another option would be to put your map centering code in Meteor.startup(function() { ... });
, but again this depends on your template structure as the map needs to be visible on the first template and not one another page (as the div element wont be on the screen)
Post a Comment for "Google Maps With Meteor Not Working"