离子 - 谷歌地图自定义按钮

时间:2017-07-25 05:56:49

标签: google-maps ionic-framework ionic2

我的离子2应用中有一个谷歌地图页面,我想在地图中添加custom button(左上角到右上角)。在按钮上单击我想在我的Typescript文件中调用一个函数。我研究了很多,但找不到一个好的答案。这就是我现在所拥有的。

initMap = () => {
     let latLng = new google.maps.LatLng(-31.563910, 147.154312);

        let mapOptions = {
              center: latLng,
              zoom: 6,
              mapTypeId: google.maps.MapTypeId.TERRAIN
         }
        this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);
}

OnMapButtonClick()
{
   //Do Something
}

(and the html is simple)

    <div [hidden]="!MapView" #map id="map"></div>

1 个答案:

答案 0 :(得分:1)

您可以使用zindexto overlapp

    <div [hidden]="!MapView" #map id="map"></div>
    <button class="button button-balanced"   ng-click="do()"   z-index="1000">