1024programmer Java Runtime error Unable to parse all parameters of GoogleMap: (?,?)

Runtime error Unable to parse all parameters of GoogleMap: (?,?)

I’m trying to load a basic map onto my template. I just followed this instruction https://ionicframework.com/docs/native/google-maps/ to get my map.

But the error I get is just like the question above.

This is my code

// Load map only after view is initialized
 ngAfterViewInit() {
  this.loadMap();
 }

 loadMap() {
  // make sure to create following structure in your view.html file
  // and add a height (for example 100%) to it, else the map won't be visible
  // 
  //
  // 

  // create a new map by passing HTMLElement
  let element: HTMLElement = document.getElementById('map');

  let map: GoogleMap = this.googleMaps.create(element);

  // listen to MAP_READY event
  // You must wait for this event to fire before adding something to the map or modifying it in anyway
  map.one(GoogleMapsEvent.MAP_READY).then(
    () => {
      console.log('Map is ready!');
      // Now you can add elements to the map like the marker
    }
  );

  // create LatLng object
  let ionic: LatLng = new LatLng(43.0741904,-89.3809802);

  // create CameraPosition
  let position: CameraPosition = {
    target: ionic,
    zoom: 18,
    tilt: 30
  };

  // move the map's camera to position
  map.moveCamera(position);

  }

 }
 

I get blank screen and I can’t print console.log in app.component.ts file

Mohan Gopi..
19

I changed my app.module.ts file

import {GoogleMaps,GoogleMap} from '@ionic-native/google-maps';

 providers: [
     StatusBar,
     SplashScreen,
     GoogleMaps,
     GoogleMap
     {provide: ErrorHandler, useClass: IonicErrorHandler}
   ]
 

About this

import {GoogleMaps} from '@ionic-native/google-maps';

 providers: [
     StatusBar,
     SplashScreen,
     GoogleMaps
     {provide: ErrorHandler, useClass: IonicErrorHandler}
   ]
 

Just removing googleMap from my providers and importing I got it working

1> Mohan Gopi..:


I changed my app.module.ts file

import {GoogleMaps,GoogleMap} from '@ionic-native/google-maps';

 providers: [
     StatusBar,
     SplashScreen,
     GoogleMaps,
     GoogleMap
     {provide: ErrorHandler, useClass: IonicErrorHandler}
   ]
 

About this

import {GoogleMaps} from '@ionic-native/google-maps';

 providers: [
     StatusBar,
     SplashScreen,
     GoogleMaps
     {provide: ErrorHandler, useClass: IonicErrorHandler}
   ]
 

Just removed googleMap from my providers and imports and I got it working

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/runtime-error-unable-to-parse-all-parameters-of-googlemap/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索