Hi Yurii.
Thanks for all your effort towards this problem.
I tried adding setting "29 Jackson's Row, Manchester M2 5WD " address for the component and marker, but this still caused the error to show.
I have changed the way the map is set up again.
I've created an additional read service (MapService) where the address is mapped to the map and marker.
I've removed all JS files relating to the map.
The map is now working without receiving the error.
I call the MapService before any other service on the page and this seems to work.
I'm still not sure what was causing the problem though.
now back to the original question.
how do i remove the map markers?
I've tried using the following function:
pre
var aofmarkers = [];
function RemoveMarkersFromMap( ) {
var i ;
for ( i = 0; i < aofmarkers.length; i++) {
aofmarkers.setMap (null);
Code: Select all
}
aofmarkers = [];
}/pre
on mapping to from address to maker in the MapService I added JS:
aofmarkers.push(maker1);
// marker1 is the marker name on component
on calling the function i received the error:
Uncaught TypeError: aofmarkers.setMap is not a function