Oreilly Map Demo Modification for Driving Directions
Oreilly Map Demo Modification for Driving Directions
Using the Oreilly map demo to map a location, I am trying to modify the Location.js in the app\view directory it to do driving directions to the location. The error is on this line: directionsRenderer.setMap(map);
After running the following code, I receive the error message "Uncaught error: Invalid value for property <map>", [object] Object
var directionRenderer;
var directionsService = new google.maps.DirectionsService();
var map;
var position = new google.maps.LatLng(HCofC.app.mapCenter[0], HCofC.app.mapCenter[1]),
infoWindow = new google.maps.InfoWindow({ content: HCofC.app.mapText }),
map, marker;
Just like when you add your marker you used map.getMap(), you need to use that reference as that is the google map instance. You are trying it on the ST2 map component.