Matt-Jensen / ember-cli-g-maps

Deprecated Google Maps Addon
http://matt-jensen.github.io/ember-cli-g-maps
MIT License
59 stars 31 forks source link

marker event call controller's action #39

Closed aansubarkah closed 8 years ago

aansubarkah commented 8 years ago

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?

Matt-Jensen commented 8 years ago

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

aansubarkah commented 8 years ago

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

Matt-Jensen commented 8 years ago

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.