Skip to content Skip to sidebar Skip to footer

How Do I Bind A Google Maps Geocoder.geocode() Callback Function

I have a view that contains a google map accessible via this.map within the view scope. All is well in the world. Next I want to update the map position via events in my view. To

Solution 1:

try changing

 geocoder.geocode({'address': location}, this.setMapLocationCallback);

using call(), so you can change the scope of this inside setMapLocationCallback

var _this = this;
 geocoder.geocode({'address': location}, function(result, status) {
     _this.setMapLocationCallback.call(_this, result, status);
 });

MDN Documentation about call() function

Post a Comment for "How Do I Bind A Google Maps Geocoder.geocode() Callback Function"