Uncaught TypeError: Cannot read property 'push' of undefined
See original GitHub issueI’m submitting a … (check one with “x”) [x] question [ ] any problem or bug report [ ] feature request
The plugin version: (check one with “x”) [ ] 2.0-beta3 (github) [x] 2.0 (npm)
cordova information: (run $> cordova plugin list
)
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-googlemaps 2.0.11 "cordova-plugin-googlemaps"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
If you use ionic-native/google-maps
, please show me the package.json
“dependencies”: {
“angular/common”: “4.1.3”,
“angular/compiler”: “4.1.3”,
“angular/compiler-cli”: “4.1.3”,
“angular/core”: “4.1.3”,
“angular/forms”: “4.1.3”,
“angular/http”: “4.1.3”,
“angular/platform-browser”: “4.1.3”,
“angular/platform-browser-dynamic”: “4.1.3”,
“ionic-native/core”: “3.12.1”,
“ionic-native/geolocation”: “^4.2.1”,
“ionic-native/google-maps”: “^4.3.0”,
“ionic-native/splash-screen”: “3.12.1”,
“ionic-native/status-bar”: “3.12.1”,
“ionic/storage”: “2.0.1”,
“ngx-translate/core”: “6.0.1”,
“ngx-translate/http-loader”: “0.0.3”,
“chart.js”: “^2.7.0”,
“cordova-android”: “^6.3.0”,
“cordova-plugin-compat”: “^1.2.0”,
“cordova-plugin-device”: “^1.1.4”,
“cordova-plugin-geolocation”: “^2.4.3”,
“cordova-plugin-googlemaps”: “git+https://github.com/mapsplugin/cordova-plugin-googlemaps.git”,
“cordova-plugin-splashscreen”: “^4.0.3”,
“cordova-plugin-statusbar”: “^2.2.2”,
“cordova-plugin-whitelist”: “^1.3.1”,
“ionic-angular”: “3.6.1”,
“ionic-plugin-keyboard”: “^2.2.1”,
“ionicons”: “3.0.0”,
“rxjs”: “5.4.0”,
“sw-toolbox”: “3.6.0”,
“tslint-config-airbnb”: “^5.3.0”,
“zone.js”: “0.8.12”
},
Current behavior: Gets an error but the marker is marked;
Uncaught TypeError: Cannot read property ‘push’ of undefined
Related code, data or error log (please format your code or data):
this.map.addMarker({
title: 'Current Location',
icon: 'red',
animation: 'DROP',
position: {
lat: this.location.lat,
lng: this.location.lng,
},
draggable: true,
}).then((marker) => {
marker.addEventListener(GoogleMapsEvent.INFO_CLICK).subscribe(() => {
console.log('ffv');
});
});
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:19 (6 by maintainers)
Top GitHub Comments
In my case the error shows when i use the old way to create map:
this.map = new GoogleMap(this.mapElement, mapOptions);
When i create the map using
this.map = this.googleMaps.create(this.mapElement, mapOptions);
, the error disapear but i can’t see map, i verify api key’s and all stufs…The error got fixed when this.map = this.googleMaps.create(this.mapElement, mapOptions); is used insted of this.map = new GoogleMap(this.mapElement, mapOptions);
Thanks @uiktiomasfeliz @wf9a5m75 for the help