# Ionic2 + native google maps

**URL:** <https://forum.ionicframework.com/t/ionic2-native-google-maps/78160>\
**Category:** ionic-v3\
**Created:** [February 2, 2017, 11:00am UTC](https://forum.ionicframework.com/t/ionic2-native-google-maps/78160 "2017-02-02T11:00:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikneke](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@vikneke](https://forum.ionicframework.com/u/vikneke)\
**Post date:** [February 2, 2017, 11:00am UTC](https://forum.ionicframework.com/t/ionic2-native-google-maps/78160/1 "2017-02-02T11:00:40Z")

</div>

I am trying to integrate google maps into my application and I have taken code from the ionic2 website, however, getting this error:

Uncaught in promise: [object, Object]

My .ts file

```
import { Component } from '@angular/core';
import { Page } from 'ionic/ionic';
import { NavController } from 'ionic-angular';
import {
 GoogleMap,
 GoogleMapsEvent,
 GoogleMapsLatLng,
 CameraPosition,
 GoogleMapsMarkerOptions,
 GoogleMapsMarker
} from 'ionic-native';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  map;

  constructor(public navCtrl: NavController) {

  }

  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
   // <ion-content>
   // <div #map id="map" style="height:100%;"></div>
   // </ion-content>

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

   let map = new GoogleMap(element);

   // listen to MAP_READY event
   map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));

   // create LatLng object
   let ionic: GoogleMapsLatLng = new GoogleMapsLatLng(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);

   // create new marker
   let markerOptions: GoogleMapsMarkerOptions = {
     position: ionic,
     title: 'Ionic'
   };

   map.addMarker(markerOptions)
     .then((marker: GoogleMapsMarker) => {
        marker.showInfoWindow();
      });
   }
}

```

and my .html file

```
<ion-header>
  <ion-navbar>
    <ion-title>Home</ion-title>
  </ion-navbar>
</ion-header>

 <ion-content>
  <div #map id="map" style="height:100%;"></div>
 </ion-content>

```

I am really struggling and can’t really understand why it is not working. I have set up the keys and installed the plugin. (followed the tutorial from: [http://ionicframework.com/docs/v2/native/google-maps/](http://ionicframework.com/docs/v2/native/google-maps/))

---

<div class="post-metadata">

**Author:** ![pauljacobv](https://avatars.discourse-cdn.com/v4/letter/p/958977/32.png) [@pauljacobv](https://forum.ionicframework.com/u/pauljacobv)\
**Post date:** [February 2, 2017, 11:40am UTC](https://forum.ionicframework.com/t/ionic2-native-google-maps/78160/2 "2017-02-02T11:40:32Z")

</div>

Hi @vikneke 🙂

If you are trying to implement Google maps javascript API’s refer these links, hope it might be helpful

[angular2-google-maps](https://github.com/SebastianM/angular2-google-maps)  
[angular-maps](https://angular-maps.com/)

---

<div class="post-metadata">

**Author:** ![kevinvavelin](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/kevinvavelin/32/106587_2.png) [@kevinvavelin](https://forum.ionicframework.com/u/kevinvavelin)\
**Post date:** [February 4, 2017, 6:04pm UTC](https://forum.ionicframework.com/t/ionic2-native-google-maps/78160/3 "2017-02-04T18:04:29Z")

</div>

He is running the native plugin accordingly with the sample shown on Ionic docs, and I have the same issue. Can’t figure out why at the moment but I will get into it and found a solution.

Don’t forget Ionic 2 is still new and a few bugs can appear so we just have to be patient with it, anyway if someone already found a solution for it don’t hesitate to share

---

<div class="post-metadata">

**Author:** ![vikneke](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@vikneke](https://forum.ionicframework.com/u/vikneke)\
**Post date:** [February 5, 2017, 10:11am UTC](https://forum.ionicframework.com/t/ionic2-native-google-maps/78160/4 "2017-02-05T10:11:12Z")

</div>

I ended up using javascript api instead, which is not native but works!

---

<div class="post-metadata">

**Author:** ![aaronksaunders](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/aaronksaunders/32/13729_2.png) [@aaronksaunders](https://forum.ionicframework.com/u/aaronksaunders)\
**Post date:** [February 11, 2017, 8:20am UTC](https://forum.ionicframework.com/t/ionic2-native-google-maps/78160/5 "2017-02-11T08:20:48Z")

</div>

i am using the same code, the only difference is I have a promise chain

`this.map.moveCamera` returns a promise and so does `this.map.addMarker`

---

<div class="post-metadata">

**Author:** ![cassianomon](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/cassianomon/32/64424_2.png) [@cassianomon](https://forum.ionicframework.com/u/cassianomon)\
**Post date:** [February 12, 2017, 11:34pm UTC](https://forum.ionicframework.com/t/ionic2-native-google-maps/78160/6 "2017-02-12T23:34:27Z")

</div>

Can you share the code? I have the same issue, I want to add static markers on a map and have it zoomed in my city
