我正在使用角度谷歌地图模块用于我的Angular应用程序(5.x.x),除了卫星切换按钮没有显示谷歌地图API的默认功能之外,每个工作正常。我在谷歌官方文档屏幕上看到,有一个选项可以禁用卫星视图,但不知道如何在角谷歌地图API中实现它。
<agm-map [latitude]="lat" [longitude]="lng">
<agm-marker [latitude]="lat"
[longitude]="lng"
[iconUrl]="'assets/images/robot/rad-tower.gif'"></agm-marker>
<agm-marker [latitude]="-34.397"
[longitude]="149.644"
[iconUrl]="'assets/images/robot/rad-tower.gif'"></agm-marker>
<agm-marker [latitude]="-33.397"
[longitude]="149.644"
[iconUrl]="'assets/images/robot/rad-tower.gif'"></agm-marker>
<agm-marker [latitude]="-33.397"
[longitude]="150.644"
[iconUrl]="'assets/images/robot/rad-tower.gif'"></agm-marker>
</agm-map>
而lat和lng是带值
的简单变量答案 0 :(得分:6)
如果要添加默认地图等切换按钮(“地图”和“卫星”),则必须输入以下代码:
<agm-map [latitude]="lat" [longitude]="lng" [scrollwheel]="false" [zoom]="zoom">
<agm-map-type-control></agm-map-type-control>
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map>
答案 1 :(得分:3)
在[fullscreenControl]='true' [mapTypeControl]='true'
<agm-map>
<agm-map [latitude]="lat" [longitude]="lng" [scrollwheel]="false" [zoom]="zoom"
[fullscreenControl]='true' [mapTypeControl]='true' >
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map>