I am trying to use ionic-native Google Maps in my application and i could see some changes in syntax on using ionic-native GoogleMaps from cordova plugin. I want to add event listener to marker. But getting error as _this._objectInstance.addEventListener is not a function at Observable.GoogleMapsMarker.addEventListener [as _subscribe].
My Ts is as follows.
var posMarker = this.map.addMarker({
'position': this.Loc,
'title': 'My Location',
'draggable':true,
'icon':'green',
'snippet':'Drag to adjust location',
'animation': GoogleMapsAnimation.DROP
});
var a = new GoogleMapsMarker(posMarker);
a.addEventListener(GoogleMapsEvent.MARKER_CLICK).subscribe(
data => alert("Marker is clicked"),
err => console.log("some error on marker listener ", err)
);
Thank you @AishApp, that sounds great, could you show me a sample of how to add the event listener to the marker there? I want to click the info and go to another page.
Google Maps resides beneath the ionic template. If you want to display the map on other page than the root page, make sure you make the background color transparent on view leave
Also to navigate from map page to other page, you have to remove the map. (Personally, I am changing the height to 0 on navigating). If you are not doing this, your ionic page will be displayed but you wont have any control over it.
.display {
background-color: transparent !important;
color: transparent !important;
//Make sure you change the display property of all elements to none here.
button{
display: none
}
}