Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70448

Google map infowindow onclick content

$
0
0

@aligassan wrote:

l have ionic app Google Map with multiple markers. I’m trying to show info in my InfoWindow for each marker . I have done completely customize the infowindow , but l want make when user click on icon marker and click on content infowindow Content navigate to another page . l did like that , but when l click on icon marker he navgate immediately to another page . !

 loadMap() {

    let htmlInfoWindow = new HtmlInfoWindow();
    let frame: HTMLElement = document.createElement('div');

    let mapOptions: GoogleMapOptions = {
      camera: {
        target: this.points,
      }

    };

    this.map = GoogleMaps.create('map_canvas', mapOptions);

    for (let i = 0; i < this.checking.features.length; i++) {

      let coords = this.checking.features[i].geometry.coordinates;
      let text = '' + this.checking.features[i].properties.title + '';
      let mag = 'M '+this.checking.features[i].properties.mag
      let date = this.checking.features[i].properties.time
      let ids = this.checking.features[i].properties.ids
      let latLng = new LatLng(coords[1], coords[0]);

      let dateTime = this.convertUTCDateToLocalDate(new Date(date));

      let finalTime = dateTime.toLocaleTimeString()

      let html = `<spanstyle="font-weight: bold;>${text}</span>
      <p style="color: #1a077d;">${mag} -  at ${finalTime} - ${ids}</p>`


      console.log(date)
      let marker: Marker = this.map.addMarkerSync({
        position: latLng,
        icon:'./assets/10.png'

      })


      marker.on(GoogleMapsEvent.MARKER_CLICK).subscribe(() => {
        htmlInfoWindow.open(marker)
        htmlInfoWindow.setContent(html)

        this._ngZone.run(() => {
          this.nav.navigateForward(`/details/${ids}`);
        })



      })




    }



  }

l want to do when user click on icon marker and shows information then if user want to click on content information navigate to another page . any idea please ?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>