I want when the user clicks on a marker, I would like a popup displays to him with some information (for example: let’s say the markers represent locations, when he clicks on a marker it displays to him all information of this location)
var locations = Locations.find();
// set all markers in the Map
locations.forEach(function(doc){
var marker = new google.maps.Marker({
position: new google.maps.LatLng(doc.screenLatitude, doc.screenLongitude),
title: doc.screenDimension,
icon:‘http://maps.google.com/mapfiles/ms/icons/blue-dot.png’
});
marker.setMap(map1); // map1 is my Google Map
marker.addListener(‘click’, function() {
// your code here
console.log(“Marker clicked”);
});