Matt-Jensen / ember-cli-g-maps

Deprecated Google Maps Addon

Home Page:http://matt-jensen.github.io/ember-cli-g-maps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

marker event call controller's action

aansubarkah opened this issue · comments

i want to pop up a modal (by toggle boolean property on controller) when double click marker, how to access controller's action by double clicking marker?

A few different ways to do this, however the simplest would probably be to provide your controller action to the marker's dblclick method. Marker documentation

I found this code working. Basicly i am accessing Ember from window property.

dblclick: function(event, marker, placeName = 'Jakarta') {
    var controller = EmberAPPName.__container__.lookup("controller:ControllerName");
    var boundSend = controller.send.bind(controller);
    boundSend('toggleCreateNewMarkerWithPlace', marker, placeName);
}

But i even don't know if that code is efficient or please js nazi

Since this code has little to do with the project, it may be more helpful if you ask this on the Ember Slack. In addition, please refrain from using defamatory language in a professional setting such as Github or the Ember Slack.