dylanfprice / angular-gm

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

Selecting markers not working in angular-gm with more current versions of Angular #75

Closed rrafey closed 9 years ago

rrafey commented 9 years ago

I've been really appreciating what angular-gm enables, but I'm finding that when I try to use a more current version of AngularJS than is in the example (in particular migrating from 1.0.7 to 1.3.5), there is no response when clicking on markers. Everything else works quite well, but it's as if the gm-on-click event isn't even triggered.

I'm using angular-gm V1.0.0.

As a first step I tried modifying the Plunker at

http://embed.plnkr.co/PYDYjVuRHaJpdntoJtqL/index.html

to use angular-gm V1.0.0 instead of V0.3.1, but in that case the markers disappear. I'm sure that's a pretty easy fix, but do you have any insights on what might be impacting the logic to click on markers when upgrading AngularJS?

maliarov commented 9 years ago

find _addNewElements function and patch one line of code:

handler(scope.$parent.$parent, context);

to

if ((angular.version.major <= 1) && (angular.version.minor <= 2)) {
  handler(scope.$parent.$parent, context);
} else {
  handler(scope.$parent.$parent.$parent , context);
}

directive's scopes hierarchy has been changed as I can see...

rrafey commented 9 years ago

Thanks for the great fix. I have confirmed that this fix works and with it, we are able to click on markers in Angular 1.3.5, but without it you can't.

I tried pushing it to a branch in https://github.com/dylanfprice/angular-gm.git, but I don't have permission. I'm hoping Dylan will integrate this change into an official version and let us know when it's available, as it is great to be able to use a fully functional Angular-GM with current versions of Angular.

jjordan1775 commented 9 years ago

I have it working with Angular 1.3.10 with the change above. I was wondering if Dylan plans on adding the fix to the next release. As it stands right now I have the AngularGM module in my bower_components folder hoping for an update soon. Just wanted to say thank you to mujichOk for the fix. Hopefully we will see an update soon.

dylanfprice commented 9 years ago

I released a new 1.0.1 version with yours and other fixes.

rrafey commented 9 years ago

This is great. Thanks so much for updating it. I'm sure others will appreciate using it with more current versions of Angular.

Thanks, Rick

On Tue, Mar 17, 2015 at 4:37 PM, Dylan Price notifications@github.com wrote:

I released a new 1.0.1 version with yours and other fixes.

— Reply to this email directly or view it on GitHub https://github.com/dylanfprice/angular-gm/issues/75#issuecomment-82641189 .