map.addEventListener(plugin.google.maps.event.MAP_READY, function(){}) doesn't work in the success callback of http request
See original GitHub issueMine is an angular based cordova app where I initialize the map view and wait for it in a controller. It works fine, when I do this:
app.controller('eventDataCTRL', ['$scope', '$location', 'eventFactory', '$http', function($scope, $location, eventFactory, $http){
$scope.eventFactory = eventFactory;
var div = document.getElementById("map_canvas");
// Initialize the map view
map = plugin.google.maps.Map.getMap(div);
// Wait until the map is ready status.
map.addEventListener(plugin.google.maps.event.MAP_READY, onMapReady([42.3601, -71.0589]));
$http({
method: 'POST',
url: "https://xyz.com/",
headers: {
'Content-Type': 'application/json'
},
data: JSON.stringify({uri:eventFactory.event_url[0]})
}).then(function successCallback(response) {
}, function errorCallback(response) {
});
But what I want is send coordinates which I get from this endpoint, or more specifically for any location (lat, long) I want. so this doesn’t work:
app.controller('eventDataCTRL', ['$scope', '$location', 'eventFactory', '$http', function($scope, $location, eventFactory, $http){
$scope.eventFactory = eventFactory;
var div = document.getElementById("map_canvas");
// Initialize the map view
map = plugin.google.maps.Map.getMap(div);
// Wait until the map is ready status.
$http({
method: 'POST',
url: "https://xyz.com/",
headers: {
'Content-Type': 'application/json'
},
data: JSON.stringify({uri:eventFactory.event_url[0]})
}).then(function successCallback(response) {
map.addEventListener(plugin.google.maps.event.MAP_READY, onMapReady([42.3601, -71.0589]));
}, function errorCallback(response) {
});
For the sake of privacy I replaced the http request url with a random url. Any help would be greatly appreciated.
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
Events | Maps JavaScript API - Google Developers
The below sample will show you what events are triggered by the google.maps.Map as you interact with the map. For a complete list...
Read more >Jquery google map plugin, adding event listeners
AddEvenListener is used because the events are not handled in a standard Javascript/jQuery way. You'll need to read through the Google Maps API...
Read more >__tcfapi function - addEventListener, removeEventListener ...
The addEventListener command registers a listener for a callback function with the CMP. The listener's callback function is triggered when ...
Read more >[Google Maps Library] Click Event | OutSystems
First you need to get the map object, and then add the listener to that map. Having that its just setting the callbacks...
Read more >Getting Started with the Google Maps JavaScript API - Part III
Adding an event listener to your map is much like using the addEventListener() method on a DOM element. In Part II of this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I will certainly donate to this wonderful and simple to use plugin you created.
Thank you for your donation!