How to use the @agm/core.AgmMarker.prototype function in @agm/core

To help you get started, we’ve selected a few @agm/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Code4SocialGood / c4sg-web / src / app / home / agmMarkerProto.js View on Github external
import { AgmMarker } from '@agm/core';
source code set hover to emit object { coord:{..}}
this code modify the prototype of AgmMarker._addEventListeners function
the modification is to emit the marker itself along with coord so we can
have access to props of 'marker' such as marker.infoWindow

AgmMarker.prototype._addEventListeners = function () {
        var _this = this;
        var cs = this._markerManager.createEventObservable('click', this).subscribe(function () {
            if (_this.openInfoWindow) {
                _this.infoWindow.forEach(function (infoWindow) { return; });
        var ds = this._markerManager.createEventObservable('dragend', this)
            .subscribe(function (e) {
            _this.dragEnd.emit({ coords: { lat:, lng: e.latLng.lng() } });
        var mover = this._markerManager.createEventObservable('mouseover', this)
            .subscribe(function (e) {
            //added target: _this to be emitted when hover