angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

[r1-dev] [blocker] ng-click inside infowindow not triggered

Open asabourin opened this issue 13 years ago • 20 comments

Hi Nicolas first of all thanks for the great work, been using the dev branch and it's really awesome.

Just one issue I've been struggling with: I can't get a ng-click on an element within an infowindow (as a directive within a marker directive within the map) to work. There's no error anywhere it just won't trigger. This is weird cause it seems the content is compiled correctly by Angular as the databinding works inside that infowindow, and I've been able to use ng-show and others inside it.

I suspect google maps API is doing something funny with the click events and I've been able to use onclick="" and element.bind() but that's not really a satisfying solution.

I am not that much proficient with Angular directive so would you have any advice to try to fix this?

Cheers

asabourin avatar Jul 01 '13 02:07 asabourin

Is this issue still in existence? If so I will look into it. Can you provide small snippet?

nmccready avatar Jul 19 '13 02:07 nmccready

Using the example page would be great.

nmccready avatar Jul 19 '13 02:07 nmccready

Hi Nem, thanks for looking into that. I've just wrote this plunker to highlight the issue: http://plnkr.co/edit/ImqKKE?p=preview

The ng-click="helloWorld()" works on an element outside the map, but not inside an infowindow within the map. I figured out it was because the infowindow has its own local scope, but even putting the helloWorld() function into the $rootScope doesnt work.

Do you think there is a way to trigger that ng-click successfully?

asabourin avatar Jul 29 '13 07:07 asabourin

Hey,

The issue is still there and my brief tries to fix it were unsuccessful. Have you have the chance to look at it ?

Cheers

lwih avatar Sep 13 '13 15:09 lwih

Just wondering if anyone has found a workaround for this.

Thanks.

VerifiedOrganic avatar Nov 04 '13 19:11 VerifiedOrganic

I believe I am working on this now and it is a confirmed problem. I found it while working on specs, this weekend. The click is currently getting triggered in feature/more_specs, but the Window is rendering in the wrong place partially.

nmccready avatar Nov 04 '13 19:11 nmccready

Help is appreciated on this task as I could use more eyes on it.

nmccready avatar Nov 04 '13 19:11 nmccready

Marked issue as blocking as r1-dev will not get moved to master until this is fixed. from @nmccready @nlaplante

nmccready avatar Nov 04 '13 19:11 nmccready

See trello board, https://trello.com/c/dibkH4sN/17-fix-window-directive-marker-clicking-example-is-broken-best-to-use-feature-more-spec-as-the-specs-are-further-along-getting-some

nmccready avatar Nov 04 '13 19:11 nmccready

Hi Nicolas, Great work man! Has a solution for this issue been found? Thanks, Mike.

mikeslim7 avatar Mar 07 '14 08:03 mikeslim7

I have the latest version of angular-google-maps yet I still have this problem. Im not sure why this issue is closed.

Any updates on this fix?

azzamallow avatar Mar 11 '14 22:03 azzamallow

This is fixed it is on develop. #243

nmccready avatar Mar 12 '14 11:03 nmccready

It is just on develop, currently here is the example. https://github.com/nlaplante/angular-google-maps/blob/develop/example/example.html#L66

nmccready avatar Mar 12 '14 11:03 nmccready

It should work with markers as well.

nmccready avatar Mar 12 '14 11:03 nmccready

Develop will be merged as soon as I can more help with closing the remaining milestone tickets is appreciated.

nmccready avatar Mar 12 '14 11:03 nmccready

It should be noted that you don't need to use a separate Controller for the ng-click handler function.

The templateParameter attribute of the window directive is exposed in the isolated window scope of the inner HTML of the directive, not just when templateUrl is used (as is documented).

You will need to set the templateParameter attribute with a function reference to a handler in your controller. To call it from inside your template or inner HTML, it is exposed via the templateParameter key in the isolated window scope. If your function requires additional parameters, use an object to provide the function reference and parameters to the isolated window scope.

The documentation in the website-develop branch has been updated to clarify that this parameter is not limited to be used only with the templateUrl parameter.

rickhuizinga avatar Mar 22 '14 03:03 rickhuizinga

Hi - do you know when this will be implemented into the most up-to-date version?

linnett avatar Mar 25 '14 14:03 linnett

Also after this, it currently does not work :-(

Quirksmode avatar Mar 25 '14 14:03 Quirksmode

Yes not on master develop hopefully soon. I think I may get some time this week (fingers crossed).

nmccready avatar Mar 25 '14 14:03 nmccready

Here is a workaround to the above problem:

You can invoke ng-click handler function from inside the info window by using $parent service like this:

examplegooglemap

VikasGarg333 avatar Jul 29 '14 17:07 VikasGarg333