Dealing with an array of marker objects labeled markers
. I've implemented a for loop to assign event listeners to each one. However, I'm struggling to determine the exact marker that was clicked.
This is my current code snippet:
for(var i = 0; i < this.markers.length; i++) //adds listener to all markers
{
google.maps.event.addListener(this.markers[i], "click", () =>
{
//need to get access to which marker was clicked
//need to use arrow function to retain proper reference to "this"
});
}
I've attempted passing arguments to the arrow function without success. Any suggestions?