使用angularjs中的ngmap显示两点之间的简单路径
我已经遵循了ngmap的和github文档,但仍然无法加载使用“directions”指令绘制并连接两个点的简单地图。(奇怪的是,我可以使用“marker”关键字在地图中绘制简单的未连接点) 我已经使用以下格式在index.html文件中包含了一个apikey:使用angularjs中的ngmap显示两点之间的简单路径,angularjs,google-maps-api-3,direction,ng-map,Angularjs,Google Maps Api 3,Direction,Ng Map,我已经遵循了ngmap的和github文档,但仍然无法加载使用“directions”指令绘制并连接两个点的简单地图。(奇怪的是,我可以使用“marker”关键字在地图中绘制简单的未连接点) 我已经使用以下格式在index.html文件中包含了一个apikey: <script src="http://maps.google.com/maps/api/js?key=APIKEY"></script> 并在我的模块中添加了ngMap作为依赖项 并在中测试了我的代码 我
<script src="http://maps.google.com/maps/api/js?key=APIKEY"></script>
并在我的模块中添加了ngMap作为依赖项
并在中测试了我的代码
我确信我只是在教程中遗漏了一些非常明显的东西。提前感谢所有的帮助和感谢
编辑:
模板代码段:
<ng-map zoom-to-include-markers="true" >
<directions
draggable="true"
panel=""
travel-mode=""
origin="14.600631955983781,120.99075458943844"
destination="14.600839603150039,120.98217152059078">
</directions>
</ng-map>
通过向方向的航路点属性添加值来解决
<directions
draggable="true"
panel=""
travel-mode=""
waypoint = /* insert locations here in between origin and destination */
origin="14.600631955983781,120.99075458943844"
destination="14.600839603150039,120.98217152059078">
</directions>
虽然我还没有找到一种方法,在一张地图上只路由两个位置 通过向方向的航路点属性添加值来解决
<directions
draggable="true"
panel=""
travel-mode=""
waypoint = /* insert locations here in between origin and destination */
origin="14.600631955983781,120.99075458943844"
destination="14.600839603150039,120.98217152059078">
</directions>
虽然我还没有找到一种方法,在一张地图上只路由两个位置 我对2个位置使用航路点的方式如下:
<directions
draggable="true"
panel=""
travel-mode=""
waypoint = {{ waypoints }}
origin="14.600631955983781,120.99075458943844"
destination="14.600839603150039,120.98217152059078">
</directions>
$scope.waypoints = [{
location: 'lat,lon'
}, {
location: 'lat,lon'
}]
$scope.waypoints=[{
位置:'lat,lon'
}, {
位置:'lat,lon'
}]
对于
航路点
,位置键可以是'lat,lon'
,也可以是文本中的地址。如果它是一个文本地址,谷歌地图将推断纬度本身我对2个位置使用航路点的方式如下:
<directions
draggable="true"
panel=""
travel-mode=""
waypoint = {{ waypoints }}
origin="14.600631955983781,120.99075458943844"
destination="14.600839603150039,120.98217152059078">
</directions>
$scope.waypoints = [{
location: 'lat,lon'
}, {
location: 'lat,lon'
}]
$scope.waypoints=[{
位置:'lat,lon'
}, {
位置:'lat,lon'
}]
对于航路点
,位置键可以是'lat,lon'
,也可以是文本中的地址。如果它是一个文本地址,谷歌地图将自己推断出纬度