Hi,
After over a week of research and trial and error. I finally managed to get multiple markers to work - Perfect!
Now, the last part of the puzzle is to display the infowindow for each of these markers. Again, much time and research and trial and error has gone into this. But I'm stumped and stuck. Below is my last code effort based directly on the code snippets provided by Appery staff here in this forum.
It doesn't work. In fact, it doesn't even display the markers! It just throws and error.
Assertion failed: InvalidValueError: setMap: not an instance of Map; and not an instance of StreetViewPanorama
Can someone please provide the correct method to walk an array, display the marker AND populate the infowindow - please
var list_location = localStorage.getItem('County_Biz_List_Storage');
var obj = JSON.parse(list_location);
var coordsArray = obj;
var marker;
var image = 'http://chart.apis.google.com/chart?ch...';
var map = Appery("Gmap").options.mapElement.gmap('get', 'map');
var CreateMarker = function(coordsArray, i){
var marker = new google.maps.Marker({
position: new google.maps.LatLng( coordsArray.lat, coordsArray.lng ),
title: coordsArray.business_name,
map: Appery("map").gmap,
});
var infowindow = new google.maps.InfoWindow({content: coordsArray.business_name});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(Appery("map").gmap,marker);
});
};
for (var i = 0, j = coordsArray.length; i < j; i++)
CreateMarker(coordsArray, i);