2017-07-25 147 views
0

我在我的離子2應用程序中有一個谷歌地圖頁面,我想在地圖上添加一個custom button(左上角到右上角)。點擊按鈕後,我想在我的Typescript文件中調用一個函數。我研究了很多,但找不到一個好的答案。這是我到現在爲止。Ionic - 谷歌地圖自定義按鈕

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

您可以使用zindexto overlapp

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

工作。你有任何想法如何按鈕點擊我可以使其全屏?我使用離子2 btw –