dylanfprice / angular-gm

AngularJS Google Maps Directives
MIT License
197 stars 47 forks source link

bug(infowindow): multiple click handlers #27

Closed bekos closed 9 years ago

bekos commented 11 years ago

If inside the body of the infoWindow I have something like

<a ng-click="show()">Click</a>

when I open the 2nd or 3rd etc infowindow and click the <a> the show() is called multiple times.

bekos commented 11 years ago

This is caused by $compiling the contents every time the infowindow opens. I think you should remove both the $compile and the element.replaceWith('<div></div>'). I am not sure about the usefulness of it.

wpalahnuk commented 11 years ago

I had similar trouble with this, it was causing ng-src to load multiples of all my images in the infowindows.

dylanfprice commented 11 years ago

Hey Tasos,

Sounds like you understand the issue better than me, would you mind making the changes and submitting a PR?

Dylan

dylanfprice commented 10 years ago
This is caused by $compiling the contents every time the infowindow opens.
I think you should remove both the $compile and the element.replaceWith('<div></div>'). 
I am not sure about the usefulness of it.

The $compile line is gone so hopefully that fixes your issue. Let me know if it doesn't. I kept the element.replaceWith('<div></div>') line since otherwise your infowindow will show up in the dom, which means you could potentially see it on the page!

irfaan commented 10 years ago

Is $compile's removal the reason for ng-click failing to fire when inside an infowindow in the latest build?