Uncaught TypeError: Cannot read property 'apply' of undefined
See original GitHub issueHi there I am getting this error when I create map and add markers to it.
Uncaught TypeError: Cannot read property ‘apply’ of undefined at Map.trigger (BaseClass.js:62) at Map.js:195
Here is my code snippet: Am I doing anything wrong ?
function displayRestaurantResultsOnMap(data) {
//Get all the restaurants info and parse the lat and long
var JERSEY = new plugin.google.maps.LatLng(49.217231, -2.140589); //Center of JERSEY
$("#searchmap-text").html('Loading...');
setTimeout(function() {
var div = document.getElementById("searchmap_canvas_div");
$('#searchmap_canvas_div').css('height', $(window).height() - $('#searchmap_canvas_div').offset().top);
mapNew = plugin.google.maps.Map.getMap(div, {
'camera': {
'latLng': JERSEY,
'zoom': 12
}
});
mapNew.on(plugin.google.maps.event.MAP_READY, searchMapInit(data));
}, 1000);
}
function searchMapInit(data) {
mapNew.clear();
mapNew.setVisible(true);
mapNew.setCameraZoom(11);
// var mData =[];
$.each(data, function(key, val) {
if (val.latitude) {
var point = new plugin.google.maps.LatLng(val.latitude, val.longitude);
var entry = {
'position': point,
'title': val.restaurant_name,
'icon': {
'url': 'https://www.cuisine.je/assets/images/menu-icon.png'
}
};
//mData.push(entry);
dump("marker options" + entry);
//Add marker
dump(mapNew)
mapNew.addMarker(entry, function(marker) {
dump("Marker added " + marker);
// Display the infoWindow
marker.showInfoWindow();
marker.setAnimation(plugin.google.maps.Animation.BOUNCE);
});
}
});
$("#searchmap-text").html('Loaded!!');
addSearchMarkers(mData, function(markers) {
markers[markers.length - 1].showInfoWindow();
markers[markers.length - 1].setAnimation(plugin.google.maps.Animation.BOUNCE);
});
}
function addSearchMarkers(data, callbac) {
var markers = [];
data.forEach(function(markerOptions) {
dump(markerOptions);
mapNew.addMarker(markerOptions, onMarkerAdd);
});
function onMarkerAdd(marker) {
dump("Marker added " + marker);
markers.push(marker);
if (markers.length === data.length) {
callbac(markers);
}
}
}
Thanks and cheers Raj
Issue Analytics
- State:
- Created 6 years ago
- Comments:25 (13 by maintainers)
Top Results From Across the Web
Cannot read property 'apply' of undefined · Issue #2359 - GitHub
When I use a regular browser like google chrome everything works as expected, then I used blisk I got an error saying app.js:14868...
Read more >Redux TypeError: Cannot read property 'apply' of undefined
If you have the devtools disabled however, __REDUX_DEVTOOLS_EXTENSION__ is undefined and becomes the second argument to compose function.
Read more >Error message "Cannot read property 'apply' of undefined"
When the UI Action is script is executed, this error is shown in the browser console: Uncaught TypeError: Cannot read property 'apply' of...
Read more >Cannot read property 'apply' of undefined" - Forums - Liferay
In the console, persistent errors : "Uncaught TypeError: Cannot read property 'apply' of undefined" In what may be the reason?
Read more >Uncaught TypeError: Cannot read property 'apply' of undefined
Uncaught TypeError : Cannot read property 'apply' of undefined · you are on master · you try with safe-mode if possible · give...
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
will do
If you want to check your project by me, please share your project files on github or bitbucket.