Javascript events are not working in marker of an map in ionic

84 Views Asked by At

I am working on an ionic project in which i am using 3d map. In this project I have created an marker on the map, on this marker I want to have the click event. following is my code

//import Wrld from 'wrld.js';
import * as eeGeo from '../../assets/js/eegeo';
import 'rxjs/add/operator/map';


ionViewDidLoad() {
    this.map = eeGeo.map("map", "57c2476b17a6a45fa03e4b8d042235d1", {
      center: [37.7858, -122.401],
      zoom: 16,
      indoorsEnabled: true,
      displayEntranceMarkers: true
    });
  }

  selectitem(item)
       {
         this.searchbar = false;
         this.cardhaed = item.title;
         this.floor = item.floor
         console.log(this.floor);

         this.lat = item.latitude;
         this.lng = item.longitude;
         this.addmarker(item);
  }
  addmarker(item)
  {

      this.marker  = eeGeo.marker([this.lat, this.lng], {
        title: item.title,
        indoorsEnabled: true,      
        indoorMapId: item.indoorid,
        displayEntranceMarkers: false,
        indoorMapFloorId: item.id
      }).addTo(this.map);

     this.marker.on('click', function(e) {
       alert(e.latlng);
  });

But in this the on event is not working. Any help ???

0

There are 0 best solutions below