Javascript Google地图方向服务()-angularJs

Javascript Google地图方向服务()-angularJs,javascript,angularjs,google-maps,google-maps-api-3,geolocation,Javascript,Angularjs,Google Maps,Google Maps Api 3,Geolocation,嗨,我有一个问题:)在AngularJS中,我为G-maps API“DirectionStatus”创建模块。模块检查我的位置(地理位置)下一个用户选择“目的地”并创建“地图方向”。看起来一切正常,但确实创建了“地图方向”。 HTML: Thx帮助:)问题在于您没有告诉directionsDisplay对象它所关联的映射。您可以在调用setDirections之前(或之后)在此添加此行 if (status == google.maps.DirectionsStatus.OK) { d

嗨,我有一个问题:)在AngularJS中,我为G-maps API“DirectionStatus”创建模块。模块检查我的位置(地理位置)下一个用户选择“目的地”并创建“地图方向”。看起来一切正常,但确实创建了“地图方向”。 HTML:


Thx帮助:)

问题在于您没有告诉
directionsDisplay
对象它所关联的映射。您可以在调用
setDirections
之前(或之后)在此添加此行

if (status == google.maps.DirectionsStatus.OK) {
    directionsDisplay.setMap(map);
    directionsDisplay.setDirections(response);
}
或者,您最好在创建地图时,在
initialize
函数中:

map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

directionsDisplay.setMap(map);
不清楚(对我来说)你的问题是什么,例如“选择目标”点击“Gow”和“$scope.calcRoute”不起作用。
if (status == google.maps.DirectionsStatus.OK) {
    directionsDisplay.setMap(map);
    directionsDisplay.setDirections(response);
}
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

directionsDisplay.setMap(map);