0

I need to print dragged when the marker is dragged is stopped in the map

i added a GoogleMapEvent.MARKERS_END it doesn't get triggerd

      this.map.addMarker({
        title: 'Current Location',
        icon: 'red',
        animation: 'DROP',
        position: {
          lat: this.location.lat,
          lng: this.location.lng,
        },
        draggable: true,
      })
        .then((marker) => {
          marker.on(GoogleMapsEvent.MARKER_DRAG_END)
            .subscribe(() => {
              console.log('dragged');
            });
          marker.on(GoogleMapsEvent.MARKER_CLICK)
            .subscribe(() => {

              alert('clicked');
            });
        });

2 Answers2

0

This was solved when using

this.map = this.googleMaps.create(this.mapElement, mapOptions);

to create the map

0
            this.map.on(GoogleMapsEvent.MAP_DRAG).subscribe(
              () => {
                let pos = this.map.getCameraTarget();
                this.marker.setPosition(pos);
              });
Reza Mahmoodi
  • 170
  • 1
  • 5